:root {
  color-scheme: light;
  --paper: #f2eee5;
  --paper-deep: #e8e2d6;
  --card: #faf8f2;
  --ink: #20332d;
  --ink-soft: #53625b;
  --muted: #817f72;
  --line: #d8d1c4;
  --accent: #ce5635;
  --accent-dark: #a53d24;
  --olive: #89916b;
  --serif: "Instrument Serif", "Iowan Old Style", "Bodoni 72", Georgia, serif;
  --mono: "DM Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 80% 9%, rgba(203, 184, 151, .18), transparent 33rem),
    linear-gradient(145deg, rgba(255,255,255,.2), transparent 38%),
    var(--paper);
  font-family: var(--mono);
  font-size: 13px;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.page-grain {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: .2;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.13'/%3E%3C/svg%3E");
}

.topbar, main, .page-footer { width: min(1440px, calc(100% - 88px)); margin-inline: auto; }
.topbar {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 25px;
  letter-spacing: -.045em;
  text-decoration: none;
}
.wordmark-dot { color: var(--accent); }
.mark { width: 25px; height: 25px; display: flex; gap: 3px; align-items: end; transform: rotate(-32deg); }
.mark span { width: 6px; background: var(--accent); border-radius: 8px 8px 1px 1px; }
.mark span:nth-child(1) { height: 12px; }
.mark span:nth-child(2) { height: 21px; background: var(--ink); }
.mark span:nth-child(3) { height: 16px; background: var(--olive); }
.topbar-right { display: flex; align-items: center; gap: 32px; }
.edition, .eyebrow, .card-index, .panel-topline, .panel-foot, .page-footer, .archive-count span:last-child, .label-light {
  font-size: 9px;
  letter-spacing: .14em;
  font-weight: 500;
}
.edition { color: var(--muted); }
.edition span { padding-inline: 5px; color: var(--accent); }
.session-status { display: flex; align-items: center; gap: 9px; color: var(--ink-soft); font-size: 10px; }
.status-light { width: 7px; height: 7px; border-radius: 50%; background: #75885b; box-shadow: 0 0 0 3px rgba(117,136,91,.13); }
.quiet-button { border: 0; border-bottom: 1px solid var(--line); padding: 5px 0; background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 10px; transition: color .18s, border-color .18s; }
.quiet-button:hover { color: var(--accent-dark); border-color: var(--accent); }

.login-view {
  position: relative;
  min-height: min(720px, calc(100vh - 158px));
  padding: clamp(70px, 11vh, 120px) 10% 90px 9%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  align-items: center;
  gap: clamp(44px, 8vw, 150px);
  overflow: hidden;
}
.login-copy { max-width: 560px; position: relative; z-index: 1; }
.eyebrow { margin: 0 0 21px; color: var(--accent-dark); }
.login-copy h1, .workspace-heading h1 {
  margin: 0;
  font: 400 clamp(64px, 8vw, 112px)/.83 var(--serif);
  letter-spacing: -.055em;
}
.login-copy h1 em, .workspace-heading h1 em, .archive-heading h2 em { color: var(--accent); font-weight: 400; }
.lede { max-width: 360px; margin: 33px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.9; }
.login-rule { max-width: 360px; margin-top: 72px; padding-top: 13px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--muted); font-size: 8px; letter-spacing: .1em; }
.login-rule span:first-child, .login-rule span:last-child { color: var(--accent); }
.login-card {
  position: relative;
  z-index: 1;
  padding: 34px;
  background: var(--card);
  border: 1px solid rgba(32,51,45,.1);
  box-shadow: 0 18px 54px rgba(50,45,34,.07);
  animation: card-arrive .6s cubic-bezier(.2,.8,.2,1) both;
}
.card-index { display: flex; justify-content: space-between; padding-bottom: 37px; color: var(--muted); }
.login-card label, .studio-panel label { display: block; margin-bottom: 9px; color: var(--ink); font-size: 11px; }
.login-card input, .studio-panel input, .studio-panel textarea, .studio-panel select {
  width: 100%; border: 1px solid var(--line); border-radius: 0; outline: 0;
  background: #f5f1e8; color: var(--ink); transition: border-color .18s, box-shadow .18s;
}
.login-card input, .studio-panel input, .studio-panel select { height: 45px; padding: 0 12px; }
.studio-panel textarea { padding: 13px 12px; resize: vertical; min-height: 128px; line-height: 1.65; }
.login-card input:focus, .studio-panel input:focus, .studio-panel textarea:focus, .studio-panel select:focus { border-color: var(--olive); box-shadow: 0 0 0 3px rgba(137,145,107,.14); }
.login-card input::placeholder, .studio-panel input::placeholder, .studio-panel textarea::placeholder { color: #a7a293; }
.field-note { margin: 8px 0 22px; color: var(--muted); font-size: 9px; line-height: 1.65; }
.button { min-height: 48px; width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 0 15px; border: 0; cursor: pointer; transition: background .18s, transform .18s, opacity .18s; }
.button:hover { transform: translateY(-2px); }
.button:disabled { cursor: wait; opacity: .65; transform: none; }
.button-dark { background: var(--ink); color: var(--paper); }
.button-dark:hover { background: #30473f; }
.button-accent { margin-top: 24px; background: var(--accent); color: #fff9ef; font-weight: 500; }
.button-accent:hover { background: var(--accent-dark); }
.button-arrow { font-size: 19px; transition: transform .18s; }
.button:hover .button-arrow { transform: translate(2px,-2px); }
.error-message { margin: 14px 0 0; color: var(--accent-dark); font-size: 10px; line-height: 1.6; }
.login-stamp { position: absolute; right: 9%; bottom: 58px; display: flex; align-items: center; gap: 8px; color: var(--olive); transform: rotate(-9deg); opacity: .7; }
.login-stamp span:first-child { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font: 18px var(--serif); letter-spacing: -.06em; }
.login-stamp span:last-child { font-size: 7px; line-height: 1.55; letter-spacing: .1em; }

.workspace-view { padding: 66px 0 76px; animation: fade-up .45s ease both; }
.workspace-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; padding: 10px 0 42px; }
.workspace-heading .eyebrow { margin-bottom: 16px; }
.workspace-heading .eyebrow span { color: var(--muted); padding-inline: 4px; }
.workspace-heading h1 { font-size: clamp(52px, 6.5vw, 82px); line-height: .9; }
.workspace-note { max-width: 230px; margin: 0 0 4px; color: var(--muted); font-size: 10px; line-height: 1.8; text-align: right; }
.workspace-grid { display: grid; grid-template-columns: minmax(290px, 365px) minmax(0, 1fr); align-items: start; gap: clamp(30px, 5vw, 72px); }
.studio-panel { position: relative; padding: 27px; background: var(--paper-deep); border: 1px solid #d9d1c3; }
.panel-topline { display: flex; justify-content: space-between; color: var(--muted); }
.panel-topline span:last-child { color: var(--accent); }
.studio-panel h2 { margin: 31px 0 27px; font: 400 43px/.92 var(--serif); letter-spacing: -.03em; }
.studio-panel form > label:not(:first-child) { margin-top: 23px; }
.char-row { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font-size: 8px; }
.form-options { display: grid; grid-template-columns: 1fr 1.35fr; gap: 12px; margin-top: 22px; }
.field-group select { padding-right: 25px; font-size: 10px; }
.label-light { margin-left: 5px; color: var(--muted); font-size: 8px; }
.panel-foot { margin-top: 25px; padding-top: 14px; border-top: 1px solid #cec7b9; display: flex; justify-content: space-between; color: var(--muted); font-size: 7px; }
.status-message { min-height: 15px; margin: 12px 0 0; color: var(--ink-soft); font-size: 9px; line-height: 1.6; }
.status-message.is-error { color: var(--accent-dark); }
.status-message.is-success { color: #536b40; }
.stock-results { max-height: 580px; margin-top: 17px; padding-top: 14px; overflow-y: auto; border-top: 1px solid #cec7b9; }
.stock-results-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 11px; color: var(--ink); font-size: 10px; }
.stock-results-heading span { color: var(--muted); font-size: 8px; }
.stock-option-grid { display: grid; gap: 9px; }
.stock-option { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 9px 11px; align-items: start; padding: 9px; background: var(--card); border: 1px solid rgba(32,51,45,.1); }
.stock-option-image { grid-row: span 2; width: 70px; height: 70px; object-fit: cover; background: var(--paper-deep); }
.stock-option-details { min-width: 0; display: grid; gap: 5px; color: var(--ink-soft); font-size: 8px; }
.stock-option-details strong { overflow: hidden; color: var(--ink); font: 15px/1.05 var(--serif); text-overflow: ellipsis; white-space: nowrap; }
.stock-option-links { display: flex; flex-wrap: wrap; gap: 8px; font-size: 8px; }
.stock-option-links a, .image-credit a { color: var(--accent-dark); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.button-stock { grid-column: 2; min-height: 34px; padding-inline: 10px; background: var(--olive); color: white; font-size: 9px; }
.button-stock:hover { background: #747d57; }
.stock-generate-anyway { min-height: 40px; margin-top: 10px; font-size: 10px; }

.archive-panel { min-width: 0; padding-top: 6px; }
.archive-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding-bottom: 21px; border-bottom: 1px solid var(--line); }
.archive-heading .eyebrow { margin-bottom: 11px; }
.archive-heading h2 { margin: 0; font: 400 clamp(39px, 4vw, 55px)/.95 var(--serif); letter-spacing: -.04em; }
.archive-count { display: flex; align-items: baseline; gap: 8px; color: var(--muted); }
.archive-count span:first-child { color: var(--ink); font: 28px/.9 var(--serif); }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; padding: 23px 0 5px; }
.image-card { min-width: 0; animation: fade-up .4s ease both; }
.image-art { position: relative; aspect-ratio: 1; overflow: hidden; background: #ddd6c9; }
.image-art::after { content: ""; position: absolute; inset: 0; border: 1px solid rgba(32,51,45,.1); pointer-events: none; }
.image-art img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.image-card:hover .image-art img { transform: scale(1.035); }
.image-art.is-loading { background: linear-gradient(110deg, #e1dbcf 8%, #f1ede4 18%, #e1dbcf 33%); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }
.image-art.is-loading img { opacity: 0; }
.image-meta { padding: 10px 0 0; }
.image-prompt { display: -webkit-box; min-height: 34px; overflow: hidden; color: var(--ink-soft); font: 15px/1.12 var(--serif); -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.image-submeta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; margin-top: 7px; color: var(--muted); font-size: 8px; letter-spacing: .035em; }
.image-origin { color: var(--ink-soft); font-size: 7px; letter-spacing: .1em; }
.image-origin.is-stock { color: var(--accent-dark); }
.image-credit { display: flex; flex-wrap: wrap; gap: 4px 9px; margin-top: 7px; color: var(--muted); font-size: 8px; line-height: 1.5; }
.image-actions { display: flex; gap: 12px; margin-top: 7px; }
.image-actions .quiet-button { font-size: 8px; }
.empty-state { min-height: 330px; padding: 59px 25px 45px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.empty-orbit { position: relative; width: 98px; height: 98px; margin-bottom: 24px; border: 1px solid var(--line); border-radius: 50%; animation: orbit-turn 30s linear infinite; }
.empty-orbit::before, .empty-orbit::after { content: ""; position: absolute; inset: 13px; border: 1px solid rgba(137,145,107,.6); border-radius: 50%; transform: rotate(53deg) scaleX(.46); }
.empty-orbit::after { transform: rotate(-53deg) scaleX(.46); }
.empty-orbit span { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.empty-orbit span:nth-child(1) { left: 15px; top: 22px; }
.empty-orbit span:nth-child(2) { right: 14px; top: 46px; width: 4px; height: 4px; background: var(--olive); }
.empty-orbit span:nth-child(3) { left: 43px; bottom: 9px; width: 3px; height: 3px; background: var(--ink); }
.empty-title { margin: 0 0 8px; color: var(--ink); font: 24px var(--serif); }
.empty-state > p:last-child { margin: 0; font-size: 9px; line-height: 1.7; }
.archive-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 17px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 8px; letter-spacing: .12em; }
.archive-footer .quiet-button { font-size: 9px; }

.page-footer { min-height: 58px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 8px; }

@keyframes card-arrive { from { opacity: 0; transform: translateY(14px) rotate(.6deg); } to { opacity: 1; transform: translateY(0) rotate(0); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { to { background-position-x: -200%; } }
@keyframes orbit-turn { to { transform: rotate(360deg); } }

@media (max-width: 950px) {
  .topbar, main, .page-footer { width: min(100% - 48px, 760px); }
  .login-view { padding-inline: 2%; gap: 35px; }
  .workspace-grid { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); gap: 28px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
}

@media (max-width: 680px) {
  .topbar, main, .page-footer { width: calc(100% - 36px); }
  .topbar { height: 68px; }
  .wordmark { font-size: 23px; }
  .topbar-right { gap: 11px; }
  .edition { display: none; }
  .session-status { gap: 7px; font-size: 8px; }
  .login-view { min-height: auto; padding: 61px 0 72px; grid-template-columns: 1fr; gap: 36px; }
  .login-copy h1 { font-size: clamp(62px, 18vw, 92px); }
  .lede { margin-top: 24px; }
  .login-rule { margin-top: 40px; }
  .login-card { padding: 25px; }
  .login-stamp { right: 3px; bottom: 19px; transform: scale(.8) rotate(-9deg); }
  .workspace-view { padding: 43px 0 58px; }
  .workspace-heading { display: block; padding-bottom: 28px; }
  .workspace-heading h1 { font-size: clamp(51px, 13vw, 70px); }
  .workspace-note { margin-top: 16px; text-align: left; max-width: 300px; }
  .workspace-grid { grid-template-columns: 1fr; gap: 36px; }
  .studio-panel { padding: 23px; }
  .studio-panel h2 { font-size: 39px; }
  .stock-results { max-height: 460px; }
  .gallery { gap: 11px; }
  .archive-heading h2 { font-size: 44px; }
  .page-footer { align-items: start; gap: 20px; padding-top: 14px; font-size: 7px; }
  .page-footer span:last-child { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
