:root {
  color-scheme: light;
  --paper: #f8f5ed;
  --surface: #fffdf7;
  --ink: #24392e;
  --muted: #566356;
  --accent: #a64430;
  --accent-strong: #823421;
  --line: #dedbd0;
  --field-border: #9b9d8f;
  --highlight: #dfe7d8;
  --heading: "Instrument Serif", "Times New Roman", serif;
  --body: "DM Sans", system-ui, sans-serif;
  font-family: var(--body);
  font-size: 100%;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; line-height: 1.55; }
h1, h2, h3, p, figure { margin: 0; }
ul { padding: 0; margin: 0; }
h1, h2, h3 { font-family: var(--heading); font-weight: 400; line-height: 1.06; }
a { color: inherit; }
img { max-width: 100%; display: block; }
input, button, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
#main:focus { outline: none; }
.skip-link { position: absolute; z-index: 10; inset: 12px auto auto 12px; transform: translateY(-200%); padding: 12px; background: var(--surface); }
.skip-link:focus { transform: none; }

.frame { width: min(100% - 72px, 1320px); margin-inline: auto; }
main.frame { flex: 1 0 auto; }
.site-header, .site-footer { border-bottom: 1px solid var(--line); }
.site-footer { border-bottom: none; border-top: 1px solid var(--line); margin-top: clamp(3rem, 8vw, 7rem); }
.header-inner, .footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; min-height: 76px; }
.footer-inner { min-height: 112px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font: 400 1.85rem/1 var(--heading); letter-spacing: -.035em; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 13px; height: 20px; background: var(--accent); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%); }
.site-nav, .footer-inner nav { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem clamp(1rem, 3vw, 2rem); }
.site-nav a, .footer-inner nav a { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; font-size: .92rem; font-weight: 600; }
.site-nav a:hover, .site-nav [aria-current], .footer-inner nav a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 5px; }

.button, .quiet {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}
.button-primary { color: var(--surface); background: var(--accent); }
.button-primary:hover:not(:disabled) { background: var(--accent-strong); }
.button-secondary { border-color: var(--field-border); background: var(--surface); }
.button-secondary:hover:not(:disabled) { border-color: var(--ink); background: var(--highlight); }
.paper-button { background: var(--surface); color: var(--ink); border-color: var(--surface); }
.paper-button:hover { background: var(--highlight); border-color: var(--highlight); }
.quiet { padding-inline: .55rem; font-size: .86rem; }
.quiet:hover:not(:disabled) { background: var(--highlight); }
.danger { color: var(--accent-strong); }
.text-link { color: inherit; text-underline-offset: .27em; text-decoration-thickness: 1px; text-decoration-color: var(--field-border); }
.text-link:hover { color: var(--accent); text-decoration-color: currentColor; }
.muted { color: var(--muted); }
.feedback { font-size: .92rem; font-weight: 600; margin-top: .55rem; overflow-wrap: anywhere; }
.feedback:empty { margin: 0; }
.feedback-error { color: var(--accent-strong); }
.page-feedback { padding: 2.2rem 0; }
.surface { background-color: var(--surface); border: 1px solid var(--line); border-radius: 11px; }

input, textarea, select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--field-border);
  border-radius: 5px;
  color: var(--ink);
  background: var(--surface);
  padding: .67rem .8rem;
  font-size: 1rem;
  line-height: 1.35;
}
textarea { resize: vertical; }
::placeholder { color: var(--muted); opacity: 1; }
.quick-add-row, .copy-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; gap: 8px; }
.field { display: grid; min-width: 0; gap: .36rem; align-content: start; font-weight: 600; font-size: .92rem; }
.field input, .field textarea, .field select { font-weight: 400; }
.split-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }

.hero { display: grid; grid-template-columns: minmax(0, .87fr) minmax(0, 1.13fr); gap: clamp(1.7rem, 5vw, 5.8rem); align-items: center; margin-top: clamp(1.4rem, 5vw, 4rem); }
.hero h1 { font-size: clamp(4.65rem, 9.3vw, 9rem); line-height: .85; letter-spacing: -.05em; }
.hero h1 em { color: var(--accent); font-weight: 400; }
.hero-description { max-width: 29ch; margin-top: 1.65rem; color: var(--muted); font-size: clamp(1.04rem, 1.55vw, 1.25rem); }
.hero .quick-add { margin-top: 1.45rem; max-width: 36rem; }
.hero-copy > .text-link { display: inline-block; margin-top: .8rem; font-size: .92rem; }
.hero-visual { position: relative; border-radius: 11px; isolation: isolate; overflow: hidden; background: var(--highlight); }
.hero-visual > img { width: 100%; aspect-ratio: 1.16; max-height: 665px; object-fit: cover; object-position: 55% center; }
.hero-caption {
  position: absolute;
  inset: auto clamp(.75rem, 3.3vw, 2rem) clamp(.75rem, 3.3vw, 2rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  padding: .85rem 1rem;
  color: var(--surface);
  background: #203327;
  border-radius: 6px;
}
.caption-label { display: block; font-size: .85rem; color: #eeeadd; }
.hero-caption strong { display: block; font: 400 clamp(1.6rem, 2.9vw, 2.6rem)/1.08 var(--heading); letter-spacing: -.02em; }
.home-section { margin-top: clamp(3.3rem, 8vw, 7rem); }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .6rem 2rem; margin-bottom: 1.3rem; }
.section-heading h2, .extension-strip h2 { font-size: clamp(2.65rem, 5.1vw, 4.4rem); letter-spacing: -.035em; }
.extension-strip { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 1rem 2rem; padding: clamp(1.4rem, 4vw, 3rem); border-radius: 11px; background: var(--ink); color: var(--surface); }
.extension-strip p { max-width: 45ch; margin-top: .65rem; }

.page-section { margin-top: clamp(1.7rem, 5vw, 4.6rem); }
.page-heading { margin-bottom: 1.55rem; }
.page-title { font-size: clamp(3.1rem, 7.5vw, 6.6rem); letter-spacing: -.04em; overflow-wrap: anywhere; }
.page-lede { color: var(--muted); font-size: clamp(1rem, 1.8vw, 1.2rem); margin-top: .55rem; max-width: 62ch; white-space: pre-wrap; overflow-wrap: anywhere; }
.page-top { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.55rem; }
.page-top .page-heading { margin-bottom: 0; }
.eyebrow { display: inline-block; margin-bottom: .65rem; font-size: .92rem; }
.empty { padding: clamp(1.25rem, 5vw, 3rem); display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1rem; }
.empty h2, .empty p { flex: 1 0 100%; }
.empty h2 { font-size: clamp(2rem, 4vw, 3.6rem); }
.empty p { color: var(--muted); padding-bottom: .35rem; }
.list-grid, .template-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.list-tile, .template-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: .4rem;
  text-decoration: none;
  padding: clamp(1rem, 3vw, 1.6rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow-wrap: anywhere;
}
.list-tile:hover, .template-card:hover { border-color: var(--accent); }
.list-tile h2, .template-card h3 { font-size: clamp(1.75rem, 3.2vw, 2.75rem); letter-spacing: -.026em; }
.list-tile { border-top: 5px solid var(--theme-dark); }
.list-tile .tile-type, .list-tile .tile-date { font-size: .88rem; color: var(--muted); }
.list-tile .tile-date { margin-top: auto; padding-top: .45rem; }
.template-card { min-height: 180px; color: var(--ink); background: var(--theme-light); }
.template-card p { color: var(--muted); max-width: 33ch; }
.template-card, [data-theme] { --theme-light: #e5ebdc; --theme-dark: #53644b; }
[data-theme="housewarming"] { --theme-light: #dfe7d8; --theme-dark: #536b51; }
[data-theme="birthday"] { --theme-light: #f0dbcd; --theme-dark: #944f3a; }
[data-theme="wedding"] { --theme-light: #eadfe6; --theme-dark: #855b72; }
[data-theme="baby"] { --theme-light: #ece5ce; --theme-dark: #796638; }
[data-theme="christmas"] { --theme-light: #e6ddd2; --theme-dark: #834234; }
.template-mark { width: 21px; height: 24px; margin: .12rem 0 .4rem; border: 2px solid var(--theme-dark); border-radius: 11px 11px 3px 3px; position: relative; }
.template-mark::after { content: ""; width: 5px; height: 5px; background: var(--theme-dark); border-radius: 50%; position: absolute; left: 6px; top: 7px; }
.template-card[data-theme="birthday"] .template-mark { border-radius: 3px; transform: rotate(-8deg); }
.template-card[data-theme="baby"] .template-mark { border-radius: 50%; }
.template-card[data-theme="wedding"] .template-mark { border-radius: 13px 13px 0 0; background: color-mix(in srgb, var(--theme-dark) 18%, transparent); }

.form-page, .panel { padding: clamp(1rem, 3vw, 1.55rem); }
.form-page, .settings-form, .item-fields { display: grid; gap: .9rem; }
.form-page { max-width: 39rem; }
.form-page button, .settings-form button, .item-fields button { justify-self: start; }
.panel h2 { font-size: clamp(1.85rem, 3vw, 2.4rem); padding-bottom: .55rem; }
.panel p + .button, .panel p + .copy-field, .panel p + .row-actions { margin-top: .8rem; }
.panel .copy-field + .text-link, .panel .button + .text-link { display: inline-block; margin: .65rem 0 0 .2rem; }
.recovery-panel .copy-field { margin-top: .65rem; }
.panel summary { font-family: var(--heading); font-size: 1.75rem; }
.panel[open] > summary { margin-bottom: .7rem; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: clamp(1rem, 3vw, 2rem); }
.editor-main, .editor-side { display: grid; align-content: start; gap: 1rem; min-width: 0; }
.editor-items { list-style: none; display: grid; gap: 10px; }
.editor-item { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .85rem; }
.item-main { display: grid; grid-template-columns: 78px minmax(0, 1fr); align-items: center; gap: .85rem; }
.item-image { background: var(--theme-light, var(--highlight)); overflow: hidden; border-radius: 6px; position: relative; isolation: isolate; }
.item-image img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; z-index: 1; }
.item-main .item-image { aspect-ratio: 1; }
.image-mark { display: block; width: 34%; height: 52%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); border: 1px solid var(--theme-dark, var(--muted)); border-radius: 50% 50% 4% 4% / 34% 34% 4% 4%; opacity: .45; }
.item-info h3 { font-size: clamp(1.5rem, 3vw, 2rem); overflow-wrap: anywhere; }
.item-info p, .item-note { overflow-wrap: anywhere; white-space: pre-wrap; margin-top: .18rem; }
.item-info .muted:empty { display: none; }
.item-edit { margin-top: .45rem; }
.item-edit summary { font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; min-height: 44px; padding: .55rem 0; }
.item-edit[open] { border-top: 1px solid var(--line); margin-top: .8rem; padding-top: .15rem; }
.item-fields { margin: .4rem 0; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem .65rem; }
.reservation-list { list-style: none; margin-top: .7rem; }
.reservation-list li { padding: .4rem 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: .35rem; overflow-wrap: anywhere; }
.reservation-list + p, .reveal-panel .button + p { margin-top: .6rem; }

.guest-heading { display: grid; justify-items: center; text-align: center; background: var(--theme-light); border-radius: 11px; padding: clamp(1.75rem, 6vw, 4.7rem) clamp(1rem, 4vw, 2.5rem); }
.guest-kicker { color: var(--muted); font-size: .9rem; margin-bottom: .55rem; }
.guest-host { font-weight: 600; margin-top: .75rem; overflow-wrap: anywhere; }
.guest-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(.8rem, 2.5vw, 1.45rem); margin-top: 1.25rem; }
.guest-heading + .feedback:not(:empty) { margin: 1.25rem 0 .5rem; }
.guest-heading ~ .empty { margin-top: 1.2rem; }
.guest-card { min-width: 0; padding: .65rem; display: flex; flex-direction: column; }
.guest-card .item-image { aspect-ratio: 1.35; }
.guest-card-content { display: flex; flex: 1; flex-direction: column; gap: .36rem; padding: .8rem .45rem .5rem; }
.guest-card h2 { font-size: clamp(1.85rem, 3vw, 2.65rem); letter-spacing: -.018em; overflow-wrap: anywhere; }
.guest-card .item-meta { color: var(--muted); font-size: .92rem; }
.guest-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; padding-top: .7rem; margin-top: auto; }
.reserve-status { border-radius: 4px; padding: .35rem .55rem; color: var(--ink); background: var(--highlight); font-weight: 600; font-size: .88rem; }
.guest-card [data-example] img { width: 100%; height: 100%; object-fit: cover; }
.guest-card [data-example="lamp"] img { transform: scale(2.3); transform-origin: 36% 33%; }
.guest-card [data-example="vase"] img { transform: scale(2.65); transform-origin: 55% 43%; }
.guest-end { margin-top: 1.5rem; text-align: center; }
.extension-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; max-width: 64rem; }
.pairing-result { margin-top: 1rem; }
.pairing-code input { font: 1rem ui-monospace, monospace; }
.pairing-result > p { margin-top: .25rem; }

@media (max-width: 920px) {
  .frame { width: calc(100% - 44px); }
  .hero h1 { font-size: clamp(4rem, 9.6vw, 7.7rem); }
  .guest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 690px) {
  .hero { grid-template-columns: 1fr; gap: 1.35rem; }
  .hero h1 { font-size: clamp(3.65rem, 15vw, 6.6rem); }
  .hero h1 br { display: none; }
  .hero h1 em { display: block; margin-top: .13em; }
  .hero-description { margin-top: 1rem; max-width: 39ch; }
  .hero .quick-add { margin-top: 1rem; }
  .hero-visual > img { aspect-ratio: 1.23; }
  .hero-caption { padding: .65rem .75rem; }
  .list-grid, .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-side { grid-row: 1; }
  .extension-panels { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .frame { width: calc(100% - 32px); }
  .header-inner, .footer-inner { min-height: auto; padding-block: .85rem; gap: .35rem .9rem; flex-wrap: wrap; }
  .site-nav { gap: 0 1.15rem; }
  .site-nav a { min-height: 32px; }
  .hero { margin-top: 1.6rem; }
  .hero .quick-add-row { grid-template-columns: 1fr; gap: .45rem; }
  .hero .quick-add-row .button { width: 100%; }
  .hero-caption .paper-button { min-height: 42px; padding-inline: .58rem; }
  .page-top { align-items: start; }
  .guest-grid, .home-templates { grid-template-columns: 1fr; }
  .guest-card { display: grid; grid-template-columns: minmax(94px, .63fr) minmax(0, 1fr); gap: .65rem; align-items: start; }
  .guest-card .item-image { aspect-ratio: 1; }
  .guest-card-content { padding: .15rem .1rem .15rem 0; }
  .guest-card h2 { font-size: 1.72rem; }
  .guest-actions { gap: .4rem; padding-top: .45rem; }
  .guest-actions .button { padding-inline: .6rem; }
  .template-card { min-height: auto; }
  .list-grid, .template-grid:not(.home-templates) { gap: .55rem; }
}

@media (max-width: 360px) {
  .frame { width: calc(100% - 26px); }
  .panel .quick-add-row { grid-template-columns: minmax(0, 1fr); }
  .pairing-code { grid-template-columns: minmax(0, 1fr); }
  .guest-card { grid-template-columns: 74px minmax(0, 1fr); }
  .guest-card h2 { font-size: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
