@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600&family=Playfair+Display:ital,wght@0,500;0,600;1,500;1,600&display=swap');

:root {
  --ink: #1a1816;
  --paper: #f5f0e9;
  --paper-deep: #e9dfd2;
  --line: rgba(26, 24, 22, 0.18);
  --muted: #716a63;
  --accent: #b77658;
  --night: #1a1816;
  --night-line: rgba(245, 240, 233, 0.18);
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'DM Sans', Arial, sans-serif;
  --mono: 'DM Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .35; }

.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.selection-shell { width: min(100%, 1600px); margin: 0 auto; overflow: hidden; }

.selection-header { min-height: 84px; padding: 0 5.4vw; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; border-bottom: 1px solid var(--line); }
.wordmark, .footer-brand { display: inline-flex; align-items: center; gap: 10px; width: max-content; font-size: 14px; font-weight: 600; letter-spacing: .01em; }
.wordmark em, .footer-brand em { color: var(--accent); font-family: var(--serif); font-weight: 500; }
.wordmark-mark { width: 17px; height: 17px; display: inline-block; border: 1px solid currentColor; border-radius: 50%; position: relative; }
.wordmark-mark::before, .wordmark-mark::after { content: ''; position: absolute; left: 50%; top: 50%; width: 1px; height: 8px; background: currentColor; transform-origin: 50% 100%; }
.wordmark-mark::before { transform: translate(-50%, -100%) rotate(36deg); }
.wordmark-mark::after { transform: translate(-50%, -100%) rotate(-36deg); }
.header-label, .eyebrow, .cover-edition, .selection-position, .rail-label, .rail-end, .conversation-status, .note-count { margin: 0; font: 500 10px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .15em; }
.header-label { justify-self: center; color: var(--muted); }
.header-actions { display: flex; justify-content: flex-end; align-items: center; gap: 22px; }
.header-client { color: var(--muted); font-size: 12px; }
.shortlist-button { border: 0; background: none; color: var(--ink); padding: 8px 0; font-size: 12px; font-weight: 600; }
.shortlist-count { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; margin-left: 6px; border-radius: 50%; background: var(--ink); color: var(--paper); font: 500 10px var(--mono); }

.cover-page { min-height: min(820px, calc(100vh - 84px)); padding: 6.5vw 5.4vw 7vw; display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(42px, 8vw, 150px); align-items: center; background: var(--paper); }
.cover-copy { max-width: 560px; }
.eyebrow { color: var(--accent); }
.cover-client { margin: 22px 0 0; color: var(--muted); font-size: 14px; }
.cover-title, .book-heading h2, .room-study h2, .shortlist-shell h2 { margin: 24px 0 0; font: 500 clamp(52px, 6.2vw, 108px)/.97 var(--serif); letter-spacing: -.055em; }
.cover-title em, .book-heading h2 em, .room-study h2 em, .shortlist-shell h2 em { color: var(--accent); font-style: italic; }
.cover-intro { max-width: 380px; margin: 30px 0 0; color: var(--muted); font-size: 16px; line-height: 1.55; }
.cover-actions { display: flex; align-items: center; gap: 20px; margin-top: 38px; }
.cover-edition { color: var(--muted); font-size: 9px; letter-spacing: .12em; }
.cover-note { margin: 76px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.cover-image-wrap { position: relative; min-height: 510px; display: flex; align-items: center; justify-content: center; background: var(--night); overflow: hidden; }
.cover-image-wrap::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 53% 45%, rgba(183, 118, 88, .28), transparent 46%); }
.cover-image-frame { width: min(68%, 560px); aspect-ratio: 1 / 1; position: relative; z-index: 1; display: grid; place-items: center; background: #eee9e2; transform: rotate(-3deg); box-shadow: 26px 28px 0 rgba(183, 118, 88, .16); }
.cover-image { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.cover-image-label { position: absolute; left: 7%; bottom: 8%; z-index: 2; color: var(--paper); font: 500 10px var(--mono); text-transform: uppercase; letter-spacing: .12em; }
.cover-image-label i { color: var(--accent); font-style: normal; margin: 0 5px; }
.cover-image-rule { position: absolute; right: 7%; top: 9%; width: 1px; height: 82%; background: var(--night-line); }

.book-page { padding: 10vw 5.4vw 8vw; background: var(--paper-deep); }
.book-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 42px; }
.book-heading h2 { font-size: clamp(48px, 5.5vw, 88px); }
.book-instruction { margin: 0 0 6px; color: var(--muted); text-align: right; font-size: 13px; line-height: 1.55; }
.book-spread { position: relative; display: grid; grid-template-columns: 90px minmax(0, 1fr); margin-top: 60px; padding: 18px 0 76px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.book-rail { display: flex; flex-direction: column; align-items: flex-start; min-height: 580px; padding: 8px 18px 0 0; border-right: 1px solid var(--line); }
.rail-label, .rail-end { color: var(--muted); writing-mode: vertical-rl; transform: rotate(180deg); }
.rail-pages { display: flex; flex: 1; flex-direction: column; align-items: stretch; gap: 5px; margin: 28px 0; width: 100%; }
.rail-page { display: grid; grid-template-columns: 22px 1fr; gap: 9px; align-items: center; padding: 8px 0; border: 0; border-top: 1px solid transparent; background: none; color: var(--muted); text-align: left; }
.rail-page span { font: 500 10px var(--mono); }
.rail-page strong { overflow: hidden; font-size: 10px; font-weight: 500; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.rail-page.is-active { color: var(--ink); border-top-color: var(--accent); }
.selection-card { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(330px, .9fr); min-height: 580px; margin-left: clamp(25px, 5vw, 90px); background: var(--paper); box-shadow: 20px 20px 0 rgba(26, 24, 22, .08); }
.selection-media { position: relative; display: grid; place-items: center; min-height: 560px; overflow: hidden; background: #eee7de; }
.selection-media::after { content: ''; position: absolute; inset: 9%; border: 1px solid rgba(26,24,22,.1); pointer-events: none; }
.selection-image { width: 84%; height: 84%; object-fit: contain; mix-blend-mode: multiply; transition: opacity .2s ease, transform .4s ease; }
.selection-number { position: absolute; top: 22px; left: 26px; z-index: 1; color: var(--accent); font: 500 11px var(--mono); }
.selection-media-caption { position: absolute; right: 24px; bottom: 23px; color: var(--muted); font: 500 9px var(--mono); text-transform: uppercase; letter-spacing: .11em; }
.selection-copy { padding: clamp(32px, 5vw, 74px) clamp(28px, 4.4vw, 72px); display: flex; flex-direction: column; }
.selection-topline { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.selection-position { color: var(--muted); font-size: 9px; }
.selection-brand { margin: 40px 0 0; color: var(--accent); font: 500 10px var(--mono); text-transform: uppercase; letter-spacing: .13em; }
.selection-name { margin: 12px 0 0; font: 500 clamp(34px, 4vw, 60px)/1.02 var(--serif); letter-spacing: -.045em; }
.selection-description { margin: 22px 0 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.selection-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; margin: 32px 0 0; border-top: 1px solid var(--line); }
.selection-specs div { padding: 14px 0 13px; border-bottom: 1px solid var(--line); }
.selection-specs dt { color: var(--muted); font: 500 9px var(--mono); text-transform: uppercase; letter-spacing: .12em; }
.selection-specs dd { margin: 7px 0 0; font-size: 12px; line-height: 1.35; }
.selection-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 15px 20px; margin-top: 28px; }
.button { display: inline-flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 44px; padding: 0 17px; border: 1px solid transparent; font-size: 11px; font-weight: 600; letter-spacing: .02em; transition: transform .2s ease, background .2s ease, color .2s ease; }
.button:hover { transform: translateY(-2px); }
.button-dark { background: var(--ink); color: var(--paper); }
.button-light { background: var(--paper); color: var(--ink); }
.button-outline { border-color: var(--ink); background: transparent; color: var(--ink); }
.text-button { padding: 8px 0; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font-size: 11px; font-weight: 600; }
.notes-panel { margin-top: 35px; padding-top: 20px; border-top: 1px solid var(--line); }
.notes-heading { display: flex; align-items: center; justify-content: space-between; }
.notes-heading .eyebrow { color: var(--muted); }
.note-count { color: var(--accent); font-size: 9px; }
.notes-list, .conversation-list { display: grid; gap: 10px; margin-top: 13px; }
.note, .conversation-message { padding: 12px 13px; background: rgba(233, 223, 210, .54); }
.note div, .conversation-message div { display: flex; justify-content: space-between; gap: 10px; }
.note strong, .conversation-message strong { font: 500 10px var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.note span, .conversation-message span { color: var(--muted); font-size: 10px; }
.note p, .conversation-message p { margin: 8px 0 0; font-size: 12px; line-height: 1.45; }
.empty-notes { margin: 0; color: var(--muted); font-size: 12px; }
.note-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; margin-top: 12px; }
.note-form textarea, .conversation-form textarea { width: 100%; resize: vertical; min-height: 42px; padding: 10px 11px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 12px; }
.note-form textarea:focus, .conversation-form textarea:focus { outline: 1px solid var(--accent); outline-offset: 2px; }
.book-controls { position: absolute; right: 0; bottom: 18px; display: flex; gap: 8px; }
.page-button { width: 43px; height: 38px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-size: 17px; }
.conversation-panel { margin: 64px 0 0 clamp(115px, 12vw, 220px); max-width: 720px; padding: 30px 0 0; border-top: 1px solid var(--line); }
.conversation-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.conversation-heading h3 { margin: 11px 0 0; font: 500 clamp(24px, 2.5vw, 34px) var(--serif); letter-spacing: -.025em; }
.conversation-status { color: var(--muted); font-size: 9px; }
.conversation-list { max-height: 260px; overflow-y: auto; }
.conversation-message.from-client { background: rgba(183, 118, 88, .14); }
.conversation-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 15px; margin-top: 15px; }

.room-study { display: grid; grid-template-columns: .9fr 1.1fr; min-height: 600px; background: var(--night); color: var(--paper); }
.room-study-copy { padding: clamp(44px, 8vw, 120px) clamp(5.4vw, 8vw, 120px); }
.eyebrow-light { color: #d18b6a; }
.room-study h2 { margin-top: 28px; font-size: clamp(52px, 6vw, 94px); }
.room-study-copy > p:not(.eyebrow) { max-width: 390px; margin: 30px 0 0; color: rgba(245,240,233,.68); font-size: 14px; line-height: 1.65; }
.room-study-controls { display: grid; gap: 13px; max-width: 390px; margin-top: 36px; }
.upload-control, .select-control { display: grid; gap: 7px; }
.upload-control > span, .select-control > span { color: rgba(245,240,233,.6); font: 500 9px var(--mono); text-transform: uppercase; letter-spacing: .13em; }
.upload-control input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-control strong { display: block; overflow: hidden; padding: 12px 13px; border: 1px solid var(--night-line); color: var(--paper); font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.upload-control strong:hover { border-color: rgba(245,240,233,.55); }
.select-control select { min-height: 42px; padding: 0 11px; border: 1px solid var(--night-line); background: var(--night); color: var(--paper); font-size: 12px; }
.room-status { margin: 1px 0 0; color: rgba(245,240,233,.54); font-size: 11px; line-height: 1.45; }
.room-study-visual { position: relative; min-height: 600px; overflow: hidden; display: grid; place-items: center; background: radial-gradient(circle at 72% 35%, rgba(183,118,88,.28), transparent 34%), linear-gradient(145deg, #3a322d, #1e1a18 68%); }
.room-study-placeholder { width: min(70%, 400px); padding: 32px; border: 1px solid rgba(245,240,233,.27); text-align: center; }
.room-study-placeholder .eyebrow { margin: 0; }
.room-study-placeholder strong { display: block; margin-top: 22px; font: 500 clamp(34px, 4vw, 58px)/.98 var(--serif); letter-spacing: -.05em; }
.room-study-placeholder strong em { color: #d18b6a; font-style: italic; }
.room-study-placeholder span { display: block; max-width: 250px; margin: 20px auto 0; color: rgba(245,240,233,.62); font-size: 12px; line-height: 1.5; }
.room-upload-preview, .room-generated-preview { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; object-fit: cover; }
.room-upload-preview { opacity: .85; }
.room-generated-preview { z-index: 5; }
.room-study-visual.has-upload .room-study-placeholder { opacity: .08; }

.selection-footer { padding: 28px 5.4vw 32px; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 30px; align-items: end; border-top: 1px solid var(--line); }
.selection-footer p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.selection-footer p:last-child { text-align: right; }

dialog { max-width: min(560px, calc(100% - 32px)); border: 0; padding: 0; background: var(--paper); color: var(--ink); box-shadow: 20px 20px 0 rgba(26,24,22,.2); }
dialog::backdrop { background: rgba(26,24,22,.7); backdrop-filter: blur(4px); }
.record-shell, .shortlist-shell { position: relative; padding: 48px; }
.dialog-close { position: absolute; top: 17px; right: 20px; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; background: none; color: var(--ink); font-size: 18px; line-height: 1; }
.record-shell h2 { margin: 20px 0 0; font: 500 42px/1 var(--serif); letter-spacing: -.04em; }
.record-id { margin: 13px 0 0; color: var(--accent); font: 500 10px var(--mono); text-transform: uppercase; letter-spacing: .12em; }
.record-copy { margin: 24px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.record-shell .button { margin-top: 28px; }
.shortlist-shell h2 { margin-top: 20px; font-size: 56px; }
.shortlist-items { display: grid; gap: 10px; margin-top: 30px; }
.shortlist-row { display: grid; grid-template-columns: 66px 1fr auto; gap: 14px; align-items: center; padding: 8px; background: var(--paper-deep); }
.shortlist-row img { width: 66px; height: 58px; object-fit: contain; mix-blend-mode: multiply; }
.shortlist-row strong, .shortlist-row span { display: block; }
.shortlist-row strong { font: 500 17px var(--serif); }
.shortlist-row span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.shortlist-remove { width: 27px; height: 27px; border: 1px solid var(--line); border-radius: 50%; background: none; color: var(--ink); }
.shortlist-shell .button { margin-top: 28px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: calc(100% - 44px); padding: 12px 15px; background: var(--ink); color: var(--paper); font-size: 12px; opacity: 0; transform: translateY(9px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.error-state { min-height: 60vh; padding: 12vw 5.4vw; }
.error-state h1 { max-width: 650px; margin: 20px 0 0; font: 500 clamp(42px, 6vw, 88px) var(--serif); letter-spacing: -.05em; }
.error-state p:last-child { color: var(--muted); }

@media (max-width: 960px) {
  .selection-header { grid-template-columns: 1fr auto; }
  .header-label { display: none; }
  .cover-page, .room-study { grid-template-columns: 1fr; }
  .cover-page { gap: 55px; }
  .cover-copy { max-width: 700px; }
  .cover-image-wrap { min-height: 500px; }
  .book-heading { display: block; }
  .book-instruction { margin-top: 24px; text-align: left; }
  .selection-card { grid-template-columns: 1fr; }
  .selection-media { min-height: 500px; }
  .book-rail { min-height: 0; }
  .rail-pages { flex-direction: row; gap: 4px; }
  .rail-page { grid-template-columns: 1fr; padding: 8px 0; border-top-color: transparent; }
  .rail-page strong { display: none; }
  .rail-label, .rail-end { writing-mode: initial; transform: none; }
  .book-rail { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 18px; padding: 0 0 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail-pages { margin: 0; }
  .conversation-panel { margin-left: 0; }
  .room-study-visual { min-height: 480px; }
  .selection-footer { grid-template-columns: 1fr 1fr; }
  .selection-footer p:last-child { text-align: left; }
}

@media (max-width: 600px) {
  .selection-header { min-height: 68px; padding: 0 20px; }
  .header-client { display: none; }
  .cover-page, .book-page { padding-left: 20px; padding-right: 20px; }
  .cover-page { min-height: auto; padding-top: 70px; padding-bottom: 70px; }
  .cover-title { font-size: 57px; }
  .cover-note { margin-top: 52px; }
  .cover-image-wrap { min-height: 360px; }
  .cover-image-frame { width: 72%; }
  .book-page { padding-top: 74px; padding-bottom: 70px; }
  .book-heading h2 { font-size: 51px; }
  .book-spread { margin-top: 40px; padding-bottom: 70px; }
  .selection-card { margin-left: 0; box-shadow: 10px 10px 0 rgba(26,24,22,.08); }
  .selection-media { min-height: 320px; }
  .selection-copy { padding: 30px 22px 28px; }
  .selection-brand { margin-top: 28px; }
  .selection-name { font-size: 40px; }
  .selection-specs { grid-template-columns: 1fr; }
  .selection-actions { align-items: flex-start; flex-direction: column; }
  .note-form, .conversation-form { grid-template-columns: 1fr; }
  .note-form .text-button { justify-self: start; }
  .book-controls { right: 0; }
  .conversation-panel { margin-top: 50px; }
  .room-study-copy { padding: 70px 20px; }
  .room-study h2 { font-size: 57px; }
  .room-study-visual { min-height: 360px; }
  .selection-footer { display: block; padding: 24px 20px 28px; }
  .selection-footer p { margin-top: 17px; }
  .record-shell, .shortlist-shell { padding: 38px 25px 28px; }
  .shortlist-shell h2 { font-size: 48px; }
}
