:root {
  --paper: #fffefe;
  --paper-soft: #f8f5ee;
  --paper-deep: #f0eadf;
  --ink: #1f1d1a;
  --muted: #777068;
  --line: #ddd6cb;
  --red: #944235;
  --green: #2f695d;
  --blue: #315f7e;
  --shadow: rgba(31, 29, 26, 0.07);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.55;
}

a {
  color: inherit;
}

img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center center;
}

.site-header {
  position: static;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  padding: 18px clamp(20px, 4vw, 54px) 8px;
  border-bottom: 0;
  background: transparent;
  backdrop-filter: none;
}

.mark,
nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  font-family: ui-monospace, "SFMono-Regular", "Courier New", Courier, monospace;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-decoration: none;
  text-transform: uppercase;
}

.mark-dot {
  width: 13px;
  height: 13px;
  border: 1px solid var(--ink);
  background: var(--red);
}

nav a {
  font-family: ui-monospace, "SFMono-Regular", "Courier New", Courier, monospace;
  font-size: 0.78rem;
  text-decoration: none;
  text-transform: uppercase;
}

nav a:hover {
  color: var(--red);
}

.filter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-nav button {
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.filter-nav button[aria-pressed="true"],
.filter-nav button:hover,
.filter-nav a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.filter-nav a {
  color: var(--muted);
}

main {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.65fr);
  gap: clamp(24px, 6vw, 88px);
  align-items: end;
  min-height: 32vh;
  padding: clamp(48px, 8vw, 96px) 0 42px;
  border-bottom: 1px solid var(--line);
}

.kicker {
  margin: 0 0 10px;
  color: var(--red);
  font-family: ui-monospace, "SFMono-Regular", "Courier New", Courier, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.7rem, 7vw, 5.8rem);
  font-weight: 400;
  line-height: 0.98;
}

.intro > p {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
}

.featured-post {
  padding: clamp(20px, 4vw, 48px) 0 clamp(42px, 7vw, 80px);
}

.post {
  display: grid;
  gap: 0;
  padding-top: clamp(20px, 4vw, 42px);
  border-top: 0;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", "Courier New", Courier, monospace;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.post h2,
.section-heading h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 400;
  line-height: 1;
}

.post-note {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.02rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(10px, 1.5vw, 16px);
  margin-top: 14px;
}

.photo {
  position: relative;
  margin: 0;
  min-height: 220px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-deep);
  box-shadow: 0 10px 28px var(--shadow);
}

.photo:nth-child(6n + 1),
.photo:nth-child(6n + 4) {
  grid-column: span 7;
  aspect-ratio: 4 / 3;
}

.photo:nth-child(6n + 2),
.photo:nth-child(6n + 3) {
  grid-column: span 5;
  aspect-ratio: 3 / 4;
}

.photo:nth-child(6n + 5),
.photo:nth-child(6n + 6) {
  grid-column: span 6;
  aspect-ratio: 1 / 1;
}

.photo figcaption {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 5px 7px;
  background: rgba(255, 253, 250, 0.9);
  border: 1px solid var(--line);
  font-size: 0.76rem;
  font-family: ui-monospace, "SFMono-Regular", "Courier New", Courier, monospace;
}

.collage-board {
  position: relative;
  aspect-ratio: 3 / 2;
  min-height: 0;
  margin-top: 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(rgba(32, 32, 32, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32, 32, 32, 0.03) 1px, transparent 1px),
    #fff;
  background-size: 24px 24px;
  overflow: hidden;
}

.collage-board .photo {
  min-height: 0;
  aspect-ratio: auto;
  grid-column: auto;
}

.collage-photo {
  position: absolute;
}

.collage-photo img {
  height: 100%;
  object-fit: contain;
}

.photo-flow {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
  gap: clamp(42px, 7vw, 92px);
  margin-top: 0;
}

.photo-flow .photo {
  min-height: 0;
  max-width: 100%;
  aspect-ratio: auto;
  overflow: visible;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  justify-self: center;
}

.photo-flow .photo img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 44vh;
  margin: 0 auto;
  object-fit: contain;
  border: 0;
  background: var(--paper-soft);
}

.journal-stream .photo {
  aspect-ratio: auto;
  overflow: visible;
}

.photo-flow .photo figcaption {
  position: static;
  display: inline-block;
  margin-top: 8px;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--muted);
}

.photo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
}

.photo-tags li {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-family: ui-monospace, "SFMono-Regular", "Courier New", Courier, monospace;
  font-size: 0.67rem;
}

.maker-flow {
  padding-bottom: 20px;
}

.flow-photo[data-offset="left"] {
  transform: none;
}

.flow-photo[data-offset="right"] {
  transform: none;
}

.journal-stream {
  display: grid;
  gap: 0;
}

.about-section {
  max-width: 620px;
  margin: clamp(70px, 12vw, 150px) 0 clamp(50px, 8vw, 110px);
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.about-section p {
  margin-bottom: 12px;
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  line-height: 1.35;
}

.about-section .about-aside {
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", "Courier New", Courier, monospace;
  font-size: 0.78rem;
}

.about-section img {
  width: min(220px, 70vw);
  height: auto;
  margin-top: 18px;
  background: transparent;
}

.dynamic-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: clamp(42px, 7vw, 110px);
  align-items: start;
}

.gallery-column {
  display: grid;
  gap: 0;
  align-content: start;
}

.gallery-photo {
  display: block;
  width: 100%;
  min-height: 0;
  margin: 0;
  aspect-ratio: auto;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.gallery-photo img {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  background: var(--paper-soft);
  cursor: zoom-in;
}

.gallery-caption {
  width: 100%;
  margin-top: 9px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  padding: 3px 0;
  font-family: ui-monospace, "SFMono-Regular", "Courier New", Courier, monospace;
  font-size: 0.74rem;
}

.gallery-caption::placeholder {
  color: var(--muted);
}

.gallery-caption:focus {
  border-bottom-color: var(--line);
  outline: 0;
}

.gallery-caption[data-state="error"] {
  border-bottom-color: var(--red);
}

.delete-mark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.68rem;
}

.delete-mark input {
  width: auto;
}

#remove-marked {
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: 0.78rem;
  text-transform: uppercase;
}

#remove-marked[data-state="error"] {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.has-lightbox {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 54px);
  background: rgba(255, 254, 254, 0.94);
  cursor: zoom-out;
}

.lightbox img {
  width: auto;
  max-width: min(1200px, 94vw);
  height: auto;
  max-height: 92vh;
  object-fit: contain;
  background: transparent;
}

.lightbox-actions {
  position: fixed;
  right: clamp(18px, 4vw, 54px);
  bottom: clamp(18px, 4vw, 54px);
}

.lightbox-actions button {
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--ink);
  padding: 4px 0;
  font-family: ui-monospace, "SFMono-Regular", "Courier New", Courier, monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  cursor: pointer;
}

.gallery-photo.space-sm {
  margin-bottom: clamp(24px, 4vw, 54px);
}

.gallery-photo.space-md {
  margin-bottom: clamp(44px, 7vw, 96px);
}

.gallery-photo.space-lg {
  margin-bottom: clamp(72px, 10vw, 150px);
}

.gallery-photo.space-xl {
  margin-bottom: clamp(110px, 15vw, 230px);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 42px;
  color: var(--muted);
  font-size: 0.84rem;
}

.maker-intro {
  max-width: 760px;
  padding: clamp(42px, 8vw, 78px) 0 30px;
  border-bottom: 1px solid var(--line);
}

.maker-intro h1 {
  margin-bottom: 18px;
}

.maker-intro p:last-child {
  color: var(--muted);
}

.maker-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 58px);
  padding: 36px 0;
  border-bottom: 1px solid var(--line);
}

.maker-form,
.maker-output,
.photo-list {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  font-family: ui-monospace, "SFMono-Regular", "Courier New", Courier, monospace;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-label input {
  width: auto;
}

input,
textarea,
select,
button {
  font-family: ui-monospace, "SFMono-Regular", "Courier New", Courier, monospace;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

button,
.file-drop {
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

button {
  width: fit-content;
  padding: 9px 12px;
}

button:hover,
.file-drop:hover {
  color: var(--red);
}

.file-drop {
  min-height: 92px;
  place-content: center;
  border-style: dashed;
  text-align: center;
}

.file-drop input {
  display: none;
}

.maker-output {
  align-content: start;
}

.maker-output h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 400;
}

.maker-output p,
.hint,
.empty-state {
  color: var(--muted);
}

pre {
  max-height: 390px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--paper-soft);
  padding: 14px;
  white-space: pre-wrap;
}

.arranger,
.preview-section {
  padding: 36px 0;
  border-bottom: 1px solid var(--line);
}

.photo-list {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.photo-item {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}

.photo-item[draggable="true"] {
  cursor: grab;
}

.photo-item img {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  background: var(--paper-soft);
}

.photo-item-fields {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.tag-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tag-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag-grid input[type="checkbox"] {
  width: auto;
}

.file-name {
  overflow-wrap: anywhere;
}

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.output-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-post {
  display: grid;
  gap: 12px;
  padding: 12px 0 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.quick-post img {
  width: min(180px, 100%);
  height: auto;
  max-height: none;
  border: 1px solid var(--line);
  background: var(--paper-soft);
  object-fit: contain;
}

.quick-post img:not([src]) {
  display: none;
}

.photo-actions button {
  padding: 6px 8px;
}

.layout-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.inbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  align-items: start;
  gap: 14px;
}

.inbox-card {
  position: relative;
  display: grid;
  gap: 8px;
  width: auto;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.inbox-card:hover,
.inbox-card.is-selected,
.inbox-card.is-active {
  border-color: var(--red);
  color: var(--red);
}

.inbox-card.is-selected,
.inbox-card.is-active {
  background: var(--paper-soft);
}

.inbox-card.is-active {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.inbox-card.is-posted {
  opacity: 0.58;
}

.posted-mark {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 5px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", "Courier New", Courier, monospace;
  font-size: 0.64rem;
  text-transform: uppercase;
}

.inbox-card img {
  width: 100%;
  height: auto;
  max-height: none;
  aspect-ratio: auto;
  border: 1px solid var(--line);
  background: var(--paper-soft);
  object-fit: contain;
}

.inbox-card img:not([src]),
.inbox-card img[src=""] {
  display: none;
}

.inbox-meta {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.maker-collage {
  touch-action: none;
  user-select: none;
}

.editable-photo {
  cursor: move;
}

.editable-photo.is-editing {
  z-index: 5;
  outline: 2px solid var(--red);
}

.resize-handle {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 18px;
  height: 18px;
  border: 1px solid var(--ink);
  background: var(--paper);
  cursor: nwse-resize;
}

@media (max-width: 760px) {
  .site-header,
  .intro,
  .section-heading {
    align-items: start;
  }

  .site-header {
    flex-direction: column;
    gap: 10px;
  }

  .intro {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .maker-layout {
    grid-template-columns: 1fr;
  }

  .photo-grid {
    grid-template-columns: 1fr;
  }

  .collage-board {
    aspect-ratio: 3 / 2;
  }

  .photo-flow {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .dynamic-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 18px;
  }

  .gallery-photo.space-sm {
    margin-bottom: 24px;
  }

  .gallery-photo.space-md {
    margin-bottom: 42px;
  }

  .gallery-photo.space-lg {
    margin-bottom: 68px;
  }

  .gallery-photo.space-xl {
    margin-bottom: 104px;
  }

  .photo-flow .photo {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    transform: none;
  }

  .photo-grid .photo:nth-child(n) {
    grid-column: auto;
    min-height: 260px;
  }

  .section-heading {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .photo-item {
    grid-template-columns: 92px minmax(0, 1fr);
  }
}
