:root {
  --bg: #f8f6f1;
  --surface: #ffffff;
  --text: #232b27;
  --muted: #626b64;
  --accent: #234b3b;
  --accent-contrast: #ffffff;
  --border: #d6dbd3;
  --radius: 12px;
  --shadow: 0 12px 36px rgb(35 43 39 / 5%);
  --soft: #edf0e9;
  --error: #922f29;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 2rem; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 1rem; line-height: 1.65; }
[hidden] { display: none !important; }
img, svg { max-width: 100%; vertical-align: middle; }
img { height: auto; }
a { color: var(--accent); text-underline-offset: .22em; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
::selection { background: #d5e4d8; color: var(--text); }
h1, h2, h3, p, figure { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 400; line-height: 1.12; letter-spacing: -.035em; text-wrap: balance; }
h1 { font-size: clamp(2.65rem, 5.7vw, 4.8rem); }
h2 { font-size: clamp(2rem, 3.6vw, 3rem); }
h3 { font-size: 1rem; line-height: 1.5; font-weight: 650; }
p { max-width: 65ch; }
p + p { margin-top: 1rem; }
em { color: var(--accent); font-weight: 400; }
.container { width: min(100% - clamp(2rem, 6vw, 5rem), 1200px); margin-inline: auto; }
.skip-link { position: fixed; top: .75rem; left: 1rem; z-index: 20; padding: .7rem 1rem; background: var(--accent); color: var(--accent-contrast); border-radius: var(--radius); transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }
.site-header { border-bottom: 1px solid var(--border); }
.header-inner { min-height: 90px; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding-block: 1rem; }
.brand { font-size: 1.3rem; font-weight: 750; letter-spacing: -.06em; text-decoration: none; color: var(--text); white-space: nowrap; }
.brand-dot { color: var(--accent); }
nav { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem 1.8rem; }
nav a { font-size: .875rem; font-weight: 550; text-decoration: none; color: var(--text); padding-block: .5rem; }
nav a:hover, nav a[aria-current="page"] { color: var(--accent); text-decoration: underline; }
nav .nav-account { border: 1px solid var(--border); border-radius: 6px; padding: .55rem .9rem; }
.hero { padding-block: clamp(3.5rem, 7vw, 6.25rem) 3rem; }
.eyebrow { color: var(--accent); font-size: .7rem; font-weight: 750; letter-spacing: .15em; line-height: 1.5; }
.hero > .eyebrow { margin-bottom: 1.4rem; }
.hero-bottom { display: flex; align-items: center; justify-content: space-between; gap: 2rem; margin-top: 1.8rem; }
.hero-bottom > p { max-width: 58ch; color: var(--muted); font-size: 1.05rem; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 1.2rem; min-height: 48px; padding: .8rem 1.25rem; border: 1px solid transparent; border-radius: 6px; font-weight: 650; font-size: .9rem; line-height: 1.5; text-decoration: none; cursor: pointer; text-align: center; transition: background-color .18s ease, border-color .18s ease; }
.button-primary { background: var(--accent); color: var(--accent-contrast); }
.button-primary:hover:not(:disabled) { background: #163b2c; }
.button-secondary { background: var(--surface); color: var(--accent); border-color: var(--border); }
.button-secondary:hover:not(:disabled) { background: var(--soft); }
.button:disabled, button:disabled { opacity: .55; cursor: not-allowed; }
.hero-bottom .button { flex-shrink: 0; }
.availability-note, .preview-note, .field-help { color: var(--muted); font-size: .79rem; line-height: 1.65; }
.hero .availability-note { margin-top: 1.8rem; max-width: 90ch; }
.studio-section { background: var(--soft); padding-block: clamp(3rem, 6vw, 5rem); border-block: 1px solid var(--border); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; margin-bottom: 2rem; }
.section-heading .eyebrow { margin-bottom: .6rem; }
.section-heading > p { color: var(--muted); font-size: .9rem; }
.studio-layout { display: grid; grid-template-columns: minmax(280px, .85fr) minmax(0, 1.75fr); gap: 1.5rem; align-items: start; }
.editor-controls { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); min-width: 0; }
.control-section h3, .generate-section h3 { margin-bottom: 1rem; }
.step-number { color: var(--accent); font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-right: .65rem; }
.upload-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .5rem; }
input:not([type="radio"]):not([type="checkbox"]), select, textarea { width: 100%; min-width: 0; min-height: 46px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 6px; padding: .65rem .8rem; }
input[type="file"] { font-size: .78rem; padding: .5rem !important; }
input::file-selector-button { border: 0; border-radius: 4px; background: var(--soft); color: var(--accent); padding: .6rem .7rem; margin-right: .6rem; font: inherit; font-weight: 650; cursor: pointer; }
input::file-selector-button:hover { background: #dce5da; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; flex-shrink: 0; }
.field-help { margin-top: .65rem; }
#file-status { overflow-wrap: anywhere; }
#file-status:empty, #editor-status:empty { display: none; }
.style-options { padding: 0; margin: 1.5rem 0; border: 0; min-width: 0; }
.style-options legend { font-size: 1rem; font-weight: 650; margin-bottom: 1rem; padding: 0; }
.style-option { display: flex; align-items: flex-start; gap: .65rem; padding: .9rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.style-option + .style-option { margin-top: .65rem; }
.style-option:has(input:checked) { border-color: var(--accent); background: #f0f5ee; }
.style-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.style-option input { margin: .2rem 0 0; }
.style-option strong { display: block; font-size: .84rem; line-height: 1.45; }
.style-description { display: block; color: var(--muted); font-size: .77rem; line-height: 1.55; margin-top: .3rem; }
.generate-section { padding-top: 1.25rem; border-top: 1px solid var(--border); }
.generate-section .button { width: 100%; margin-top: 1rem; }
.preview-workspace { min-width: 0; }
.preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.preview-panel { min-width: 0; }
.preview-panel figcaption { padding: .6rem .2rem 1rem; }
.preview-panel h3 { margin-top: .25rem; }
.photo-frame { aspect-ratio: 3 / 4; position: relative; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: #f7f8f4; }
.result-panel .photo-frame { background: #e3e9df; border-color: #c9d2c4; }
.photo-frame img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: contain; }
.preview-placeholder { padding: 1.25rem; text-align: center; color: var(--muted); }
.preview-placeholder svg { margin-bottom: 1.3rem; color: var(--accent); }
.preview-placeholder p { color: var(--text); font-family: var(--serif); font-size: 1.25rem; line-height: 1.35; text-wrap: balance; }
.preview-placeholder span { display: block; margin-top: .75rem; font-size: .77rem; line-height: 1.6; }
.preview-note { margin-top: 1rem; }
.result-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.result-actions p { font-size: .875rem; flex: 1 1 200px; }
.loading-state { display: flex; align-items: center; gap: .75rem; margin-top: 1rem; font-size: .85rem; color: var(--accent); }
.loading-spinner { width: 20px; height: 20px; flex-shrink: 0; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-message, [role="alert"]:not(:empty) { margin-top: 1rem; padding: .85rem 1rem; border: 1px solid #d9aaa5; border-radius: 6px; background: #fff0ee; color: var(--error); font-size: .875rem; overflow-wrap: anywhere; }
[role="status"] { font-size: .85rem; }
.guide-section { padding-block: clamp(4rem, 9vw, 7rem); }
.guide-layout { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 7vw, 7rem); }
.guide-layout h2 { margin-block: .8rem 1.3rem; }
.guide-layout p:not(.eyebrow) { color: var(--muted); }
.photo-tips { margin: 0; }
.photo-tips > div { border-top: 1px solid var(--border); padding-block: 1.2rem; }
.photo-tips dt { font-weight: 650; font-size: .95rem; }
.photo-tips dd { margin: .4rem 0 0; color: var(--muted); font-size: .9rem; }
.site-footer { border-top: 1px solid var(--border); padding-block: 2rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem 2rem; }
.footer-inner p, .footer-inner small { color: var(--muted); font-size: .8rem; }
.account-main, .auth-main { padding-block: clamp(3rem, 8vw, 6rem); }
.account-layout, .auth-layout { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: clamp(2rem, 6vw, 5rem); }
.account-intro h1, .auth-intro h1 { margin-block: 1rem 1.5rem; font-size: clamp(2.4rem, 4vw, 3.7rem); }
.account-intro p, .auth-intro p { color: var(--muted); }
.account-card, .auth-card { width: 100%; max-width: 560px; padding: clamp(1.5rem, 4vw, 2.5rem); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.account-card h2, .auth-card h2 { font-size: 2rem; margin-bottom: 1rem; }
.account-card form, .auth-card form { display: grid; gap: 1rem; }
.form-field { display: grid; gap: .4rem; }
.form-field label, .auth-card label { font-size: .875rem; font-weight: 600; }
.account-actions, .auth-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.auth-tabs { display: flex; gap: .5rem; margin-bottom: 1.5rem; }
.auth-tabs button { flex: 1; }
.auth-tabs [aria-selected="true"] { background: var(--accent); color: var(--accent-contrast); }
.account-email, #account-email { overflow-wrap: anywhere; }
.account-card .availability-note, .auth-card .availability-note { margin-top: 1.5rem; }

@media (min-width: 1400px) {
  .studio-layout { gap: 2rem; }
}
@media (max-width: 1000px) {
  .hero-bottom { align-items: flex-start; }
  .studio-layout { grid-template-columns: minmax(260px, .85fr) minmax(0, 1fr); }
  .preview-grid { grid-template-columns: 1fr; }
  .photo-frame { aspect-ratio: 4 / 3; }
}
@media (max-width: 760px) {
  .header-inner { align-items: flex-start; flex-direction: column; gap: .6rem; }
  nav { gap: .4rem 1.2rem; }
  nav a { font-size: .8rem; }
  .hero-bottom { flex-direction: column; gap: 1.25rem; }
  .hero { padding-top: 3rem; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: .75rem; }
  .studio-layout, .guide-layout, .account-layout, .auth-layout { grid-template-columns: 1fr; }
  .preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photo-frame { aspect-ratio: 3 / 4; }
  .guide-layout { gap: 2rem; }
  .account-card, .auth-card { max-width: none; }
}
@media (max-width: 480px) {
  .preview-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .photo-frame { aspect-ratio: 1 / 1; }
  .editor-controls { padding: 1.1rem; }
  .hero-bottom .button { width: 100%; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: .65rem; }
  .account-actions, .auth-actions { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
