@font-face{font-family:'DM Sans';font-style:normal;font-weight:400;font-display:swap;src:url('assets/dm-sans-0.ttf') format('truetype')}
@font-face{font-family:'DM Sans';font-style:normal;font-weight:500;font-display:swap;src:url('assets/dm-sans-1.ttf') format('truetype')}
@font-face{font-family:'DM Sans';font-style:normal;font-weight:600;font-display:swap;src:url('assets/dm-sans-2.ttf') format('truetype')}
@font-face{font-family:'DM Sans';font-style:normal;font-weight:700;font-display:swap;src:url('assets/dm-sans-3.ttf') format('truetype')}

/* The comparison board: your photo takes one of four equal squares beside
   three real reference photos. The empty square is the only bright thing
   on the page, so the action needs no explaining. */
:root{
  --page:#f2f3ef;     /* pale stone */
  --ink:#24201a;      /* soil */
  --muted:#5e5548;    /* loam, 6.5:1 on page */
  --shoot:#c9e265;    /* new shoots: the photo action and matches only */
  --shoot-strong:#b8d64e;
  --stem:#3d6a28;     /* links, focus */
  --soil:#2a2219;     /* behind photos */
  --wash:#e5e8df;     /* quiet fills */
  --line:#d6d9cf;
  --white:#fff;
  --gap:10px;
  --tile-radius:18px;
  --board:min(max(calc(100svh - 128px),380px),720px,54vw);
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--page);color:var(--ink);font:400 16px/1.55 'DM Sans',system-ui,sans-serif;-webkit-font-smoothing:antialiased}
h1,h2,h3,p,dl,dd{margin:0}
a{color:var(--stem);text-underline-offset:3px;text-decoration-thickness:1px}
a:hover{text-decoration-thickness:2px}
button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
button:disabled{cursor:wait;opacity:.55}
:focus-visible{outline:3px solid var(--stem);outline-offset:3px}
#result-title:focus:not(:focus-visible){outline:none}
svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.icon-library,[hidden]{display:none!important}
.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.skip-link{position:fixed;top:-100px;left:16px;z-index:20;background:var(--ink);color:var(--page);padding:10px 16px;border-radius:8px;text-decoration:none;font-weight:600}
.skip-link:focus{top:10px}

/* ---------- Header ---------- */
.header{max-width:1280px;height:56px;margin:0 auto;padding:0 32px;display:flex;align-items:center;justify-content:space-between;gap:12px}
.brand{display:inline-flex;align-items:center;gap:7px;color:var(--ink);text-decoration:none;font-size:16px;font-weight:700;letter-spacing:-.02em;white-space:nowrap}
.brand>span:last-child{margin-left:-7px;color:var(--muted);font-weight:400}
.brand-mark{display:grid;place-items:center;color:var(--stem);--leaf-stroke:var(--page)}
.brand-mark svg{width:24px;height:24px;stroke:none}
.header nav{display:flex;align-items:center;gap:6px}
.nav-link{border:0;background:none;padding:9px 10px;border-radius:8px;font-size:15px;font-weight:500;color:var(--muted)}
.nav-link:hover{color:var(--ink);background:var(--wash)}
.share-button{display:inline-flex;align-items:center;gap:7px;min-height:40px;padding:0 14px;border:0;border-radius:999px;background:var(--ink);color:var(--page);font-size:15px;font-weight:600}
.share-button:hover{background:#3a3228}
.share-button svg{width:16px;height:16px}

/* ---------- Layout: board left, answer right ---------- */
.main{max-width:1280px;margin:0 auto;padding:8px 32px 32px;display:grid;grid-template-columns:var(--board) minmax(0,1fr);grid-template-rows:auto 1fr;grid-template-areas:"board intro" "board panel";column-gap:56px;align-items:start}
.intro{grid-area:intro;padding-top:6px}
.board{grid-area:board}
.panel{grid-area:panel;margin-top:28px;display:flex;flex-direction:column;gap:28px;max-width:34rem}
h1{font-size:clamp(2rem,1rem + 2.6vw,3.4rem);font-weight:700;line-height:1.02;letter-spacing:-.04em;text-wrap:balance}
.lede{margin-top:12px;max-width:30em;font-size:17px;line-height:1.5;color:var(--muted);text-wrap:pretty}

/* ---------- The board ---------- */
.board-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:var(--gap);width:var(--board);height:var(--board)}
.tile{position:relative;min-width:0;min-height:0;border-radius:var(--tile-radius);overflow:hidden;background:var(--soil)}
.board-caption{margin-top:10px;font-size:13px;line-height:1.4;color:var(--muted)}

/* Your square, empty: the photo action */
.drop-zone{position:absolute;inset:0;z-index:2;background:var(--shoot)}
.choose{position:absolute;inset:0;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:16px 16px 76px;border:0;background:transparent;color:var(--ink);text-align:center}
.choose:hover{background:var(--shoot-strong)}
.choose:focus-visible,.take:focus-visible{outline:3px solid var(--ink);outline-offset:-7px;border-radius:calc(var(--tile-radius) - 2px)}
.choose svg{width:44px;height:44px;stroke-width:1.5;margin-bottom:8px}
.choose-title{font-size:24px;font-weight:700;line-height:1.15;letter-spacing:-.025em}
.choose-hint,.choose-drop{font-size:15px;line-height:1.35;color:#3e3a20}
.take{position:absolute;left:14px;right:14px;bottom:14px;z-index:1;display:flex;align-items:center;justify-content:center;gap:8px;min-height:46px;border:1.5px solid var(--ink);border-radius:12px;background:transparent;font-size:15px;font-weight:600;color:var(--ink)}
.take:hover{background:rgba(255,255,255,.4)}
.take svg{width:18px;height:18px}
.drop-zone.drag-over{background:var(--shoot-strong)}
.drop-zone.drag-over::after{content:"";position:absolute;inset:10px;border:2px dashed var(--ink);border-radius:12px;pointer-events:none}
@media (hover:none){.choose-drop{display:none}}

/* Your square, filled */
.preview-panel{position:absolute;inset:0}
.drop-zone:not([hidden]) ~ .preview-panel{display:none}
.preview-panel>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
#remove-photo{position:absolute;top:10px;right:10px;z-index:3;display:grid;place-items:center;width:38px;height:38px;border:0;border-radius:50%;background:var(--white);color:var(--ink);font-size:24px;line-height:1}
#remove-photo:focus-visible{outline-color:var(--shoot)}
.preview-label{position:absolute;left:10px;bottom:10px;z-index:3}
/* While inspecting, one line sweeps the photo. */
.preview-panel:has(#remove-photo:disabled)>img{opacity:.75}
.preview-panel:has(#remove-photo:disabled)::after{content:"";position:absolute;left:0;right:0;top:-60px;height:120px;z-index:2;pointer-events:none;
  background:linear-gradient(to bottom,transparent,rgba(201,226,101,.25) 46%,var(--shoot) 50%,rgba(201,226,101,.25) 54%,transparent);
  animation:scan 2.2s ease-in-out infinite alternate}
@keyframes scan{to{top:calc(100% - 60px)}}

/* Reference squares */
.example{display:block;width:100%;height:100%;padding:0;border:0;text-align:left;color:var(--ink)}
.example>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;transition:transform .35s ease}
.example:hover>img{transform:scale(1.035)}
.example[data-example=leafy]>img{object-position:50% 38%}
.example[data-example=normal]>img{object-position:50% 40%}
.tile-label{position:absolute;left:10px;right:10px;bottom:10px;display:flex;flex-direction:column;align-items:flex-start;gap:6px}
.chip{display:inline-block;padding:5px 11px;border-radius:999px;background:var(--white);color:var(--ink);font-size:14px;font-weight:600;line-height:1.3;white-space:nowrap}
.match-note{display:inline-block;padding:5px 11px;border-radius:999px;background:var(--shoot);color:var(--ink);font-size:13px;font-weight:700;line-height:1.3}
.example.is-match{outline:3px solid var(--ink);outline-offset:3px}
.example.is-match:focus-visible{outline-color:var(--stem)}

/* ---------- The answer panel ---------- */
.inspection-content h2{font-size:26px;font-weight:700;line-height:1.15;letter-spacing:-.025em;margin:12px 0 10px}
#ready-state>h2,#loading-state>h2{margin-top:0}
.inspection-content p{margin-bottom:18px;color:var(--muted);text-wrap:pretty}
.inspection-content .result-description{color:var(--ink)}
.inspection-content .result-action{padding:12px 14px;border-radius:12px;background:var(--wash);color:var(--ink);font-size:15px;line-height:1.5}
.inspection-content .download-note,.inspection-content .result-caution{margin:14px 0 0;font-size:14px}
.result-buttons{display:flex;flex-wrap:wrap;align-items:center;gap:8px 20px}
.result-label{display:inline-block;padding:4px 10px;border-radius:6px;font-size:14px;font-weight:600;line-height:1.4}
.result-label.amber{background:#f3e3b8;color:#5e410d}
.result-label.green{background:#ddedb4;color:#2b4a1c}
.result-label.neutral{background:#e3e1da;color:#433c33}

.primary-button{display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:50px;padding:0 22px;border:0;border-radius:999px;background:var(--shoot);color:var(--ink);font-size:16px;font-weight:700}
.primary-button:hover{background:var(--shoot-strong)}
.primary-button:active{transform:translateY(1px)}
.primary-button.small{min-height:46px;padding:0 20px;font-size:15px}
.text-button{border:0;background:none;padding:8px 2px;font-size:15px;font-weight:600;color:var(--ink);text-decoration:underline;text-decoration-color:var(--muted);text-underline-offset:4px}
.text-button:hover{text-decoration-thickness:2px}

.loading-spinner{position:relative;display:block;width:96px;height:4px;margin-bottom:18px;border-radius:2px;background:var(--line);overflow:hidden}
.loading-spinner::after{content:"";position:absolute;top:0;bottom:0;left:0;width:40%;border-radius:2px;background:var(--stem);animation:slide 1.2s ease-in-out infinite}
@keyframes slide{from{transform:translateX(-100%)}to{transform:translateX(250%)}}

.file-error{padding:12px 14px;border-radius:12px;background:#f3e3b8;color:#5e410d;font-size:15px}

/* Guide: shown before a photo is added, gone while checking. */
.inspection:not([hidden]) ~ .guide{display:none}
.guide h2{font-size:15px;font-weight:700;margin-bottom:6px}
.guide dl>div{display:grid;grid-template-columns:8.5em minmax(0,1fr);gap:12px;padding:10px 0;border-top:1px solid var(--line)}
.guide dt{font-size:15px;font-weight:600}
.guide dd{font-size:15px;line-height:1.45;color:var(--muted)}

.notes{list-style:none;margin:0;padding:0;display:grid;gap:10px}
.notes li{display:flex;gap:10px;font-size:15px;line-height:1.45;color:var(--muted)}
.notes svg{width:18px;height:18px;margin-top:2px;color:var(--stem)}
.notes button{padding:0;border:0;background:none;color:var(--stem);font-weight:600;text-decoration:underline;text-underline-offset:3px}

.links{display:flex;flex-wrap:wrap;gap:6px 20px;font-size:14px}
.links a,.links button{padding:0;border:0;background:none;color:var(--ink);font-weight:600;text-decoration:underline;text-decoration-color:var(--line);text-underline-offset:4px;text-decoration-thickness:2px}
.links a:hover,.links button:hover{text-decoration-color:var(--stem)}
.contribute-hint{margin-top:6px;font-size:13px;color:var(--muted)}
@media (min-width:861px) and (max-width:1100px){.guide dl>div{grid-template-columns:minmax(0,1fr);gap:2px}}

/* ---------- Dialogs ---------- */
dialog{width:min(560px,calc(100% - 32px));max-height:90dvh;overflow:auto;padding:36px;border:0;border-radius:20px;background:var(--white);color:var(--ink);box-shadow:0 24px 80px rgba(36,32,26,.3)}
dialog::backdrop{background:rgba(36,32,26,.5)}
body:has(dialog[open]){overflow:hidden}
dialog h2{font-size:26px;font-weight:700;line-height:1.15;letter-spacing:-.025em;margin:4px 48px 14px 0}
dialog h3{font-size:16px;font-weight:700;margin:24px 0 6px}
dialog p{color:var(--muted);line-height:1.65;margin-bottom:14px}
dialog strong{color:var(--ink)}
.close-dialog{position:absolute;top:12px;right:12px;width:44px;height:44px;display:grid;place-items:center;border:0;border-radius:50%;background:none;font-size:26px;line-height:1;color:var(--ink)}
.close-dialog:hover{background:var(--wash)}
.dialog-leaf{display:block;color:var(--stem);--leaf-stroke:var(--white);margin-bottom:10px}
.dialog-leaf svg{width:28px;height:28px;stroke:none}
.help-link{font-weight:600}
.sources-list{list-style:none;padding:0;margin:0 0 8px}
.sources-list li{padding:11px 0;border-bottom:1px solid var(--line)}
dialog .licenses{font-size:14px}
.example-dialog{width:min(680px,calc(100% - 32px));padding:0}
.example-dialog>img{display:block;width:100%;height:52dvh;object-fit:contain;background:var(--soil)}
.photo-close{background:var(--white)}
.photo-close:hover{background:var(--wash)}
.example-body{padding:24px 32px 30px}
.reference-label{display:inline-block;padding:4px 10px;border-radius:999px;background:var(--wash);font-size:13px;font-weight:600}
.example-body h2{margin:12px 0 8px}
.example-body a{font-weight:600}
textarea{width:100%;resize:vertical;padding:12px;border:1px solid var(--line);border-radius:10px;background:var(--white);color:var(--ink);font:15px/1.5 'DM Sans',system-ui,sans-serif}

.toast{position:fixed;left:50%;bottom:24px;z-index:20;max-width:calc(100% - 32px);padding:12px 20px;border-radius:999px;background:var(--ink);color:var(--page);font-size:15px;font-weight:500;text-align:center;opacity:0;transform:translate(-50%,12px);pointer-events:none;transition:opacity .15s,transform .15s}
.toast.visible{opacity:1;transform:translate(-50%,0)}

/* ---------- Stacked: question, board, answer ---------- */
@media (max-width:860px){
  .main{max-width:600px;grid-template-columns:minmax(0,1fr);grid-template-rows:auto;grid-template-areas:"intro" "board" "panel";padding:4px 20px 32px}
  .intro{padding-top:4px;margin-bottom:18px}
  .board-grid{width:100%;height:auto;aspect-ratio:1}
  .panel{margin-top:24px;max-width:none}
}

@media (max-width:600px){
  :root{--gap:8px;--tile-radius:14px}
  .header{height:52px;padding:0 16px}
  .brand{font-size:15px;gap:6px}
  .brand>span:last-child{margin-left:-6px}
  .brand-mark svg{width:22px;height:22px}
  .nav-link{font-size:14px;padding:8px}
  .share-button{width:40px;padding:0;justify-content:center}
  .share-button>span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
  .main{padding:2px 16px 28px}
  .intro{margin-bottom:14px}
  h1{font-size:30px}
  .lede{margin-top:6px;font-size:15px;line-height:1.45}
  .choose{padding:10px 10px 56px;gap:2px}
  .choose svg{width:30px;height:30px;margin-bottom:4px}
  .choose-title{font-size:17px}
  .choose-hint{font-size:13px}
  .take{left:8px;right:8px;bottom:8px;min-height:40px;font-size:14px;border-radius:10px}
  .take svg{width:16px;height:16px}
  .tile-label{left:7px;right:7px;bottom:7px;gap:4px}
  .chip{font-size:13px;padding:4px 9px}
  .match-note{font-size:12px;padding:4px 9px}
  #remove-photo{top:7px;right:7px;width:34px;height:34px;font-size:22px}
  .preview-label{left:7px;bottom:7px}
  .board-caption{font-size:13px}
  .inspection-content h2{font-size:23px}
  .guide dl>div{grid-template-columns:minmax(0,1fr);gap:2px}
  dialog{padding:30px 22px 24px;border-radius:18px}
  dialog h2{font-size:23px}
  .example-dialog{padding:0}
  .example-dialog>img{height:44dvh}
  .example-body{padding:20px 22px 24px}
}
@media (max-width:360px){
  .choose-hint{display:none}
  .chip{white-space:normal}
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{transition:none!important;animation:none!important}
  .preview-panel:has(#remove-photo:disabled)::after{top:auto;bottom:0;height:4px;background:var(--shoot)}
  .loading-spinner::after{width:100%;opacity:.6}
}
