@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 400 500;
  font-display: swap;
}
:root {
  --bg: #F7F3EE; --card: #FFFFFF; --ink: #2B2522; --muted: #6B6158; --hair: #E4DACF;
  --line: #8C8174; --accent: #9A5047; --accent-soft: #F4E5DF;
  --serif: "Fraunces", Georgia, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
:focus-visible, .sr:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* header */
.top { display: flex; justify-content: space-between; align-items: center; max-width: 560px; margin: 0 auto;
  padding: 14px 18px 2px; font-size: 13px; }
.brand { font-family: var(--serif); font-weight: 500; font-size: 15px; }
.units { display: inline-flex; gap: 2px; font-size: 12px; }
.units label { position: relative; }
.chip { display: inline-block; border: 1px solid transparent; border-radius: 999px; padding: 2px 9px; color: var(--muted); cursor: pointer; }
input:checked + .chip { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* title */
main { max-width: 560px; margin: 0 auto; padding: 0 18px; } /* phones and tablets: one column, the photo never wider than a phone's */
h1 { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1.06; letter-spacing: -0.01em; margin: 10px 0 6px; }
h1 i { color: var(--accent); }
.free { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.steps { display: flex; gap: 12px; font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.steps span { display: inline-flex; align-items: center; gap: 6px; }
.steps span + span::before { content: ""; width: 14px; height: 1px; background: var(--hair); margin-right: 6px; }

/* photo and skirt type */
#hero { position: relative; aspect-ratio: 3 / 4; border-radius: 18px; overflow: hidden; background: #EFE9E0; }
#hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 250ms ease; }
#hero img.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #hero img { transition: none; } }
.types { position: absolute; left: 10px; right: 10px; bottom: 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.types label { position: relative; }
.types span { display: block; text-align: center; border: 1px solid rgba(255, 255, 255, .7); border-radius: 999px; padding: 6px 0 5px;
  background: rgba(255, 255, 255, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); line-height: 1.1; cursor: pointer; }
.types b { display: block; font-family: var(--serif); font-weight: 500; font-size: 15px; }
.types small { font-size: 10.5px; color: var(--muted); }
.types input:checked + span { background: #fff; border-color: var(--accent); color: var(--accent); }
.types input:checked + span small { color: var(--accent); }

/* choices */
.label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 22px 0 8px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.label em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 12px; }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-size: 13px; font-weight: 500; text-transform: none;
  letter-spacing: 0; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.opts { display: grid; gap: 6px; }
.c4 { grid-template-columns: repeat(4, 1fr); } .c3 { grid-template-columns: repeat(3, 1fr); } .c2 { grid-template-columns: repeat(2, 1fr); }
.opts label { position: relative; display: block; }
.pill { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; width: 100%; padding: 8px 4px;
  border: 1px solid var(--hair); border-radius: 999px; background: var(--card); color: var(--ink); font-size: 14px; cursor: pointer; }
input:checked + .pill, .pill[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* number fields: label, number, one line */
.fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
.field { border-bottom: 1px solid var(--line); padding: 0 0 4px; }
.field label, .field .lab { display: block; font-size: 12px; color: var(--muted); }
.field div { display: flex; align-items: baseline; gap: 4px; }
.field input { width: 100%; min-width: 0; border: 0; outline: 0; background: none; padding: 0; color: var(--ink);
  font-family: var(--serif); font-size: 23px; -moz-appearance: textfield; appearance: textfield; }
.field input::-webkit-outer-spin-button, .field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field .u { color: var(--muted); font-size: 13px; }
.field:focus-within { border-bottom: 2px solid var(--accent); margin-bottom: -1px; }
.field.bad { border-bottom-color: var(--accent); }
.field.bad input { color: var(--accent); }
.field.ghost { border-bottom-style: dashed; border-bottom-color: var(--hair); }
.field.narrow { max-width: 160px; margin-top: 12px; }
.na { font-size: 13px; font-style: italic; color: var(--muted); line-height: 33px; }
.range { font-size: 12px; color: var(--accent); margin: 5px 0 0; }

details { margin-top: 22px; border-top: 1px solid var(--hair); padding-top: 12px; font-size: 13.5px; color: var(--muted); }
summary { cursor: pointer; }
summary b { color: var(--ink); font-weight: 500; }
.allow { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 12px; }
.allow label b { color: var(--ink); font-weight: 600; }

.cta { display: block; width: 100%; margin: 24px 0 4px; border: 0; border-radius: 999px; padding: 14px;
  background: var(--accent); color: #fff; font-size: 15.5px; font-weight: 600; letter-spacing: .01em; }
.formerr { color: var(--accent); font-size: 13.5px; margin: 8px 0 0; text-align: center; }

/* result */
.card { margin-top: 20px; background: var(--card); border: 1px solid var(--hair); border-radius: 18px; padding: 18px 16px 16px; }
.card h2 { font-family: var(--serif); font-weight: 400; font-size: 23px; margin: 0 0 14px; }
.res { display: grid; grid-template-columns: 100px 1fr; gap: 18px; align-items: center; }
#preview { display: block; width: 100px; height: 100px; background: var(--bg); border-radius: 12px; }
#preview .cut { fill: var(--accent-soft); stroke: var(--ink); stroke-width: 1.1; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
#preview .seam { fill: none; stroke: var(--accent); stroke-width: .9; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.facts { display: grid; gap: 11px; }
.fact { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: center; margin: 0; font-size: 12px; color: var(--muted); }
.fact b { display: block; font-family: var(--serif); font-weight: 500; font-size: 19px; line-height: 1.1; color: var(--ink); }
.fact svg { color: var(--ink); }
.paper { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; padding-top: 12px;
  border-top: 1px solid var(--hair); font-size: 13px; color: var(--muted); }
.sw { display: inline-flex; gap: 4px; }
.sw label { position: relative; }
.sw .chip { border-color: var(--hair); padding: 3px 11px; color: var(--ink); }
.dl { display: block; margin-top: 12px; padding: 12px; border-radius: 999px; background: var(--accent); color: #fff;
  text-align: center; text-decoration: none; font-size: 15px; font-weight: 600; }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; text-align: center; }
.err { color: var(--accent); font-size: 15px; margin: 0; }
.card.fail h2, .card.fail .res, .card.fail .paper, .card.fail .dl, .card.fail .hint { display: none; }

/* coming soon */
#more { margin-top: 28px; }
#more h2 { font-family: var(--serif); font-weight: 400; font-size: 20px; margin: 0 0 10px; }
.door { flex-direction: column; gap: 4px; border-radius: 16px; padding: 10px 4px; font-size: 13px; }
#w { margin-top: 14px; font-size: 14px; }
#w p { margin: 0 0 10px; }
.email { display: block; max-width: 360px; color: var(--muted); font-size: 12px; }
.email input { display: block; width: 100%; margin-top: 2px; padding: 4px 0 5px; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; background: none; outline: 0; font-size: 16px; color: var(--ink); }
.email input:focus { border-bottom: 2px solid var(--accent); padding-bottom: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0; }
.check input { accent-color: var(--accent); margin-top: 3px; }
.cta.small { display: inline-block; width: auto; margin: 0; padding: 10px 22px; font-size: 14px; }
#wMsg { color: var(--muted); }

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 26px 0 20px; }
footer a, .check a { color: var(--accent); }

/* how to measure */
#measure { width: min(440px, 100%); max-width: 100%; margin: auto auto 0; padding: 16px 16px 20px; border: 0;
  border-radius: 22px 22px 0 0; background: var(--bg); color: var(--ink); }
#measure::backdrop { background: rgba(43, 37, 34, .4); }
#measure h2 { display: flex; justify-content: space-between; align-items: center; margin: 0 0 10px;
  font-family: var(--serif); font-weight: 400; font-size: 22px; }
#measureClose { border: 0; background: none; padding: 0 4px; font-size: 24px; line-height: 1; }
.measure { position: relative; width: min(100%, 37.5vh); aspect-ratio: 3 / 4; margin: 0 auto; border-radius: 16px; overflow: hidden; }
.measure img { display: block; width: 100%; height: 100%; object-fit: cover; filter: brightness(.94) saturate(.9); }
.measure svg { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 0 1.5px rgba(30, 24, 21, .9)); }
.tag { position: absolute; transform: translate(-50%, -50%); padding: 5px 9px; border-radius: 999px; background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25); font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; }
.tag.l { transform: translate(calc(-100% - 6px), -50%); }
.legend { display: grid; gap: 6px; margin: 12px 0 0; font-size: 13.5px; }
.legend div { display: flex; gap: 8px; }
.legend dt { min-width: 54px; font-weight: 600; }
.legend dd { margin: 0; }

/* computer: the photo is as tall as the window allows and stays in place, everything else on the right;
   both columns grow with the screen and sit in the middle together */
@media (min-width: 900px) {
  :root {
    --form: clamp(340px, 36vw, 460px);
    --gap: clamp(32px, 4vw, 72px);
    --pad: clamp(24px, 4vw, 64px);
    /* 3:4 photo: fits the window height (minus header), the width left by the form, and at most 760 px */
    --photo: min(calc((100vh - 80px) * 3 / 4), calc(100vw - var(--form) - var(--gap) - 2 * var(--pad) - 20px), 760px);
  }
  .top { max-width: calc(var(--photo) + var(--gap) + var(--form) + 2 * var(--pad)); padding: 16px var(--pad) 2px; }
  .calc { max-width: none; display: grid; grid-template-columns: var(--photo) var(--form); column-gap: var(--gap);
    justify-content: center; align-items: start; padding: 10px var(--pad) 0; }
  #f { display: contents; }
  .calc > *, #f > * { grid-column: 2; }
  #hero { grid-column: 1; grid-row: 1 / span 30; position: sticky; top: 16px; }
  h1 { font-size: 42px; }
  #measure { margin: auto; border-radius: 22px; }
}
