/* ocd.toys home: a dollhouse cross-section of one house.
   House colours are concrete (from OCD.palette) and identical in both themes. */
.home {
  --brick: #a95f44;
  --brick-hi: #b86c4f;
  --slab: #5e4330;      /* walnut */
  --slab-hi: #6f523d;
  --stone: #c9bda9;     /* plasterDeep */
  --linen: #e9e1d2;
  --gold-leaf: #d4a640;
  --glass: #5f7f86;     /* glaze */
  --wall: clamp(7px, 1.5vw, 14px);
  --slab-h: clamp(20px, 2.6vw, 26px);
  --sky: transparent;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .home { --sky: #161b24; --glass: #d1a046; }
}
:root[data-theme="dark"] .home { --sky: #161b24; --glass: #d1a046; }

.home-main { width: 100%; max-width: 1040px; margin: 0 auto; padding: 40px 16px 24px; flex: 1; }

/* ---------- wordmark ---------- */
.home-head { text-align: center; margin-bottom: clamp(20px, 4vw, 40px); }
.wordmark {
  margin: 0;
  font: 400 clamp(48px, 10vw, 92px)/1 var(--serif);
  font-variation-settings: 'opsz' 144;
  letter-spacing: -.035em;
  user-select: none; -webkit-user-select: none;
}
.wordmark span { display: inline-block; }
.wordmark .crooked {
  cursor: pointer;
  transform: rotate(-11deg) translate(.02em, -.05em);
  transform-origin: 50% 60%;
  transition: transform .45s cubic-bezier(.3, 1.6, .5, 1);
}
.wordmark .crooked:hover { transform: rotate(-13deg) translate(.02em, -.06em); }
.wordmark .crooked.fixed { transform: none; cursor: default; }
.lede { margin: 12px 0 0; font: italic 400 clamp(17px, 2.2vw, 20px)/1.4 var(--serif); color: var(--ink-2); }

/* ---------- sky + house ---------- */
.homestead {
  position: relative;
  padding: clamp(24px, 5vw, 56px) clamp(0px, 3vw, 40px) 0;
  border-radius: 14px 14px 0 0;
  background: var(--sky);
  overflow-x: clip;
}
.homestead::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background:
    radial-gradient(circle at 12% 14%, rgba(240, 210, 122, .9) 0 1.6%, rgba(240, 210, 122, .14) 1.7% 5%, transparent 5.2%),
    radial-gradient(1px 1px at 22% 30%, #efe7db 50%, transparent 51%),
    radial-gradient(1px 1px at 34% 10%, #efe7db 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 61% 7%, #efe7db 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 18%, #efe7db 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 9%, #efe7db 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 95% 32%, #efe7db 50%, transparent 51%),
    radial-gradient(1px 1px at 5% 40%, #efe7db 50%, transparent 51%),
    radial-gradient(1px 1px at 48% 4%, #efe7db 50%, transparent 51%),
    linear-gradient(to bottom, transparent 55%, var(--bg));
  opacity: 0;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .homestead::before { opacity: 1; } }
:root[data-theme="dark"] .homestead::before { opacity: 1; }

.house { position: relative; max-width: 920px; margin: 0 auto; }
.roof { display: block; width: 106%; height: auto; margin: 0 -3% -1px; }
.oculus-glass { fill: var(--glass); transition: fill .4s; }

.facade {
  position: relative;
  background: var(--brick);
  padding-top: calc(var(--slab-h) * .5);
  box-shadow: inset 0 10px 14px -10px rgba(42, 28, 15, .45);
}
/* attic floor / top ceiling */
.facade::before {
  content: ''; position: absolute; left: calc(var(--wall) * .5); right: calc(var(--wall) * .5); top: 0;
  height: calc(var(--slab-h) * .5); background: var(--slab);
}

.floors {
  --cols: 4;
  list-style: none; margin: 0; padding: 0 var(--wall);
  display: flex; flex-wrap: wrap-reverse; column-gap: var(--wall); row-gap: 0;
}
.cell { flex: 0 0 calc((100% - (var(--cols) - 1) * var(--wall)) / var(--cols)); min-width: 0; }
.attic { display: none; }
.attic.a4 { display: block; }
@media (max-width: 880px) {
  .floors { --cols: 3; }
  .attic.a4 { display: none; }
  .attic.a3 { display: block; }
}
@media (max-width: 560px) {
  .floors { --cols: 2; }
  .attic.a3 { display: none; }
  .attic.a2 { display: block; }
}

.room { display: block; text-decoration: none; color: inherit; position: relative; }
.room:focus-visible { outline: none; }
.interior {
  position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden;
  background: #ece4d6;
}
.interior img, .interior svg { display: block; width: 100%; height: 100%; object-fit: cover; }
/* depth: ceiling and party-wall shadow inside each room */
.interior::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  box-shadow: inset 0 9px 12px -8px rgba(42, 28, 15, .5), inset 7px 0 10px -8px rgba(42, 28, 15, .35);
}
/* warm light that comes on */
.interior::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse 70% 85% at 50% -5%, rgba(255, 214, 140, .5), rgba(255, 200, 120, .12) 60%, transparent 80%);
  mix-blend-mode: screen; opacity: 0; transition: opacity .35s;
}
.room img { transition: filter .35s; }
a.room:hover .interior::after, a.room:focus-visible .interior::after { opacity: 1; }
a.room:hover img, a.room:focus-visible img { filter: brightness(1.04) saturate(1.06); }
a.room:focus-visible .interior { outline: 2px solid var(--gold-leaf); outline-offset: -2px; }

.plaque {
  position: absolute; left: 50%; bottom: 10%; z-index: 2;
  transform: translate(-50%, 4px); opacity: 0;
  max-width: calc(100% - 16px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 5px 11px 6px; border-radius: 2px;
  background: rgba(247, 243, 236, .94); color: #2a2420;
  font: 500 clamp(13px, 1.6vw, 16px)/1 var(--serif); letter-spacing: -.01em;
  box-shadow: 0 2px 8px rgba(42, 28, 15, .22);
  transition: opacity .25s, transform .25s;
}
a.room:hover .plaque, a.room:focus-visible .plaque { opacity: 1; transform: translate(-50%, 0); }

.best {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  font: 500 10px/1 var(--mono); letter-spacing: .02em; color: #2a2420;
  background: rgba(247, 243, 236, .9); border-radius: 2px; padding: 4px 6px;
}
.best:empty { display: none; }
.room.is-perfect .best { background: var(--gold-leaf); color: #2a2420; }

.slab {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--slab-h); color: var(--linen);
}
.slab::before {
  content: ''; position: absolute; top: 0; bottom: 0; z-index: 0;
  left: calc(var(--wall) * -.5 - .5px); right: calc(var(--wall) * -.5 - .5px);
  background: linear-gradient(to bottom, var(--slab-hi), var(--slab) 30%);
}
.room-name {
  position: relative; font: italic 400 clamp(12px, 1.5vw, 14px)/1 var(--serif);
  letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attic .room-name { opacity: .6; }
.gold-mark { position: relative; display: none; width: 7px; height: 7px; background: var(--gold-leaf); transform: rotate(45deg); box-shadow: 0 0 6px rgba(240, 210, 122, .7); }
.room.is-perfect .gold-mark { display: inline-block; }

.plinth { height: clamp(8px, 1.4vw, 14px); background: var(--stone); margin: 0 -.6%; box-shadow: inset 0 3px 0 rgba(255, 250, 240, .35); }

.ground { position: relative; z-index: 1; display: block; width: 100%; height: 84px; margin-top: -30px; }

@media (max-width: 560px) {
  .home-main { padding-top: 28px; }
  .best { top: 4px; right: 4px; font-size: 9px; padding: 3px 5px; }
}

/* ---------- today bar ---------- */
.today {
  display: inline-flex; align-items: center; gap: 10px 22px; flex-wrap: wrap; justify-content: center;
  margin-top: 22px; padding: 10px 18px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper);
  font: 13px/1 var(--mono); color: var(--ink-2);
}
.today-progress { display: inline-flex; align-items: center; gap: 10px; }
.today-bar { width: 90px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.today-bar span { display: block; height: 100%; width: 0; background: var(--gold-leaf); transition: width .6s ease; }
.today-streak { color: var(--gold-leaf); }
.today.is-complete { border-color: var(--gold-leaf); }

/* ---------- view toggle ---------- */
.view-toggle { display: flex; justify-content: center; gap: 4px; margin-top: 18px; }
.view-toggle button { padding: 8px 16px; font-size: 13px; border-color: transparent; color: var(--ink-3); }
.view-toggle button[aria-selected="true"] { color: var(--ink); border-color: var(--line); background: var(--paper); }
.view[hidden] { display: none !important; }

/* ---------- rooms list ---------- */
.rooms { max-width: 860px; margin: 8px auto 0; display: grid; gap: 40px; }
.kind-name { font: 500 28px/1 var(--serif); letter-spacing: -.01em; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.kind-name span { font: italic 400 16px var(--serif); color: var(--ink-3); margin-left: 8px; }
.kind-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 12px; }
.row {
  display: grid; grid-template-columns: 112px 1fr auto; gap: 16px; align-items: center;
  padding: 10px; border-radius: 10px; text-decoration: none; color: inherit;
  background: var(--paper); border: 1px solid var(--line);
  transition: border-color .2s, transform .2s;
}
.row:hover, .row:focus-visible { border-color: var(--gold-leaf); transform: translateY(-1px); outline: none; }
.row img { width: 112px; height: 84px; border-radius: 5px; object-fit: cover; display: block; box-shadow: var(--frame-shadow); }
.row-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-room { font: italic 13px/1 var(--serif); color: var(--ink-3); }
.row-title { font: 500 20px/1.15 var(--serif); }
.row-tag { font-size: 14px; color: var(--ink-2); }
.row-best { font: 500 12px/1 var(--mono); color: var(--ink-3); padding-right: 6px; white-space: nowrap; }
.row.is-done .row-best { color: var(--good); }
.row.is-perfect .row-best { color: var(--gold-leaf); }
.row.is-perfect .row-best::before { content: '◆ '; }
@media (max-width: 480px) {
  .row { grid-template-columns: 88px 1fr; }
  .row img { width: 88px; height: 66px; }
  .row-best { grid-column: 2; padding: 0; }
}

/* ---------- reserved ad slot ---------- */
.ad { min-height: 0; margin: 40px auto 0; max-width: 728px; }
@media (max-width: 480px) { .today { border-radius: 16px; } }
