/* Toy garage (home, #garage): the open stern garage of a catamaran, the toys on its back wall as equipment tags.
   The object brings its own materials: gelcoat surround and hatch, anthracite perforated panel, stainless rails
   and hooks, white card tags with steel eyelets, a teak floor. Sky blue only marks the tags you took.
   The tag parts (.peg, .tag ...) are reused small on the preference sheet (/plan). */

.gar, .tags-small {
  --gel: #f4f6f7;
  --gel-2: #dde3e7;
  --panel: #2b3238;
  --panel-2: #1c2227;
  --hole: rgb(6 10 14 / .7);
  --steel-hi: #f4f6f8;
  --steel: #b7bec5;
  --steel-lo: #69727b;
  --card: #fdfdfb;
  --card-2: #efeee8;
  --card-ink: #13202b;
  --card-muted: #56626c;
  --card-line: #d3d8dc;
  --cord: #ece8df;
  --teak: #94704c;
  --teak-2: #775838;
  --seam: #2a2119;
  --led: #fffaf0;
}
@media (prefers-color-scheme: dark) {
  .gar, .tags-small {
    --gel: #2c3339;
    --gel-2: #1f252a;
    --panel: #20262b;
    --panel-2: #14181c;
    --card: #ecebe6;
    --card-2: #dbd9d2;
    --card-line: #c4c6c4;
    --cord: #d9d5cc;
    --teak: #6f5439;
    --teak-2: #58422c;
  }
}

/* ---------- the object ---------- */

.gar {
  position: relative; padding: 20px 20px 24px; border-radius: 16px;
  background: linear-gradient(180deg, var(--gel) 0%, var(--gel-2) 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .7), inset 0 -2px 0 rgb(0 0 0 / .05), 0 30px 60px -30px rgb(20 32 44 / .45);
  overflow: clip;
}
@media (prefers-color-scheme: dark) {
  .gar { box-shadow: inset 0 1px 0 rgb(255 255 255 / .06), 0 30px 60px -30px rgb(0 0 0 / .7); }
}

.gar-bay {
  --pad: clamp(14px, 2.4vw, 34px);
  position: relative; isolation: isolate; overflow: hidden;
  padding: 56px var(--pad) 0; border-radius: 10px 10px 4px 4px;
  background-color: var(--panel);
  background-image:
    radial-gradient(circle at 50% 50%, var(--hole) 0 2px, rgb(255 255 255 / .06) 2.4px, transparent 3px),
    linear-gradient(180deg, rgb(0 0 0 / .25), rgb(0 0 0 / 0) 30%, rgb(0 0 0 / 0) 80%, rgb(0 0 0 / .3));
  background-size: 22px 22px, 100% 100%;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .55), inset 0 14px 26px rgb(0 0 0 / .5), inset 14px 0 22px -10px rgb(0 0 0 / .45), inset -14px 0 22px -10px rgb(0 0 0 / .45);
}

/* the light from the ceiling switches on as the hatch lifts */
.gar-ceiling { position: absolute; inset: 0 0 auto; height: 44px; z-index: 0; background: linear-gradient(180deg, #11161a, rgb(17 22 26 / 0)); }
.gar-led {
  position: absolute; top: 32px; left: 10%; right: 10%; height: 3px; border-radius: 2px;
  background: var(--led); box-shadow: 0 0 10px 2px rgb(255 240 214 / .55), 0 0 40px 8px rgb(255 240 214 / .18);
  opacity: .2; transition: opacity .7s ease 1s;
}
.gar-glow {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(70% 55% at 50% 0%, rgb(255 244 226 / .22) 0%, rgb(255 244 226 / .07) 55%, rgb(255 244 226 / 0) 100%);
  opacity: 0; transition: opacity .9s ease 1s;
}
.gar.is-open .gar-led, .gar.is-open .gar-glow { opacity: 1; }

.gar-floor {
  position: relative; z-index: 1; display: block; height: 34px; margin: 6px calc(var(--pad) * -1) 0;
  background:
    linear-gradient(180deg, rgb(0 0 0 / .55), rgb(0 0 0 / 0) 60%),
    repeating-linear-gradient(90deg, var(--teak) 0 22px, var(--seam) 22px 24px, var(--teak-2) 24px 47px, var(--seam) 47px 49px);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .12);
}

/* the hatch: closed over the opening, lifts straight up into the frame; its lower edge with the grip
   stays in sight at the top of the opening, as on a raised garage door */
.gar-door {
  position: absolute; z-index: 5; inset: 0; pointer-events: none;
  border-radius: 10px 10px 2px 2px;
  background: linear-gradient(180deg, #fbfcfc 0%, #eef1f3 50%, #dfe4e8 100%);
  box-shadow: inset 0 0 0 1px rgb(20 30 40 / .1), inset 0 -14px 24px rgb(20 30 40 / .06), 0 8px 14px rgb(0 0 0 / .45);
  transition: transform 1.7s cubic-bezier(.65, 0, .25, 1) .1s;
}
.gar-door::after { /* the rubber seal along its lower edge */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 0 0 2px 2px; background: #3b4248;
}
.gar-seam { position: absolute; left: 4%; right: 4%; top: 38%; height: 1px; background: rgb(20 30 40 / .1); box-shadow: 0 1px 0 rgb(255 255 255 / .8); }
.gar-grip {
  position: absolute; left: 50%; bottom: 7px; width: 120px; height: 8px; margin-left: -60px; border-radius: 4px;
  background: linear-gradient(180deg, rgb(20 30 40 / .3), rgb(20 30 40 / .08)); box-shadow: inset 0 2px 3px rgb(20 30 40 / .3), 0 1px 0 rgb(255 255 255 / .8);
}
@media (prefers-color-scheme: dark) {
  .gar-door { background: linear-gradient(180deg, #353d44 0%, #2a3137 55%, #232a30 100%); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .4), 0 8px 14px rgb(0 0 0 / .55); }
  .gar-door::after { background: #0e1215; }
  .gar-seam { background: rgb(0 0 0 / .35); box-shadow: 0 1px 0 rgb(255 255 255 / .05); }
  .gar-grip { background: linear-gradient(180deg, rgb(0 0 0 / .5), rgb(0 0 0 / .2)); box-shadow: inset 0 2px 3px rgb(0 0 0 / .5), 0 1px 0 rgb(255 255 255 / .06); }
}
.gar.is-open .gar-door { transform: translateY(calc(-100% + 22px)); }

/* ---------- the wall: rows of hooks on stainless rails ---------- */

.gar-wall {
  --pitch: 182px; --tagw: 124px; --tagh: 114px; --cordh: 30px;
  position: relative; z-index: 1; list-style: none; margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--tagw) + 14px), 1fr)); grid-auto-rows: var(--pitch);
  background: repeating-linear-gradient(180deg,
    transparent 0 9px, rgb(0 0 0 / .35) 9px 10px, var(--steel-hi) 10px 11px, var(--steel) 11px 15px, var(--steel-lo) 15px 17px, rgb(0 0 0 / .4) 17px 20px, transparent 20px var(--pitch));
}

.peg { position: relative; display: grid; justify-items: center; align-content: start; min-width: 0; }
/* the hook on the rail */
.peg::before {
  content: ""; position: absolute; z-index: 3; top: 8px; left: 50%; width: 5px; height: 16px; margin-left: -2.5px; border-radius: 1px 1px 3px 3px;
  background: linear-gradient(90deg, var(--steel-lo), var(--steel-hi) 45%, var(--steel) 70%, var(--steel-lo));
  box-shadow: 0 3px 3px rgb(0 0 0 / .45);
}

.tag {
  position: relative; display: grid; justify-items: center; margin-top: 20px; padding: 0; border: 0; background: none;
  color: var(--card-ink); font: inherit; text-align: center; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transform-origin: 50% 0; rotate: var(--r);
  transition: rotate .55s cubic-bezier(.3, 1.5, .5, 1);
}
.tag:focus-visible { outline: none; }
.tag:focus-visible .tag-card { outline: 2px solid var(--sky); outline-offset: 5px; }
.tag-cord { position: relative; z-index: 2; display: block; width: 14px; height: var(--cordh); margin-bottom: -14px; pointer-events: none; }
.tag-cord svg { display: block; width: 100%; height: 100%; overflow: visible; }
.tag-cord path { fill: none; stroke: var(--cord); stroke-width: 1.6; stroke-linecap: round; vector-effect: non-scaling-stroke; transition: stroke .3s ease; }

.tag-card {
  position: relative; display: grid; grid-template-rows: auto 1fr auto; justify-items: center; gap: 6px;
  width: var(--tagw); height: var(--tagh); padding: 27px 9px 11px;
  filter: drop-shadow(0 8px 7px rgb(0 0 0 / .42)) drop-shadow(0 1px 1px rgb(0 0 0 / .35));
  transition: translate .4s cubic-bezier(.2, .9, .3, 1.2), scale .4s cubic-bezier(.2, .9, .3, 1.2), filter .4s ease;
}
/* card stock with the two top corners cut */
.tag-card::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  clip-path: polygon(15px 0, calc(100% - 15px) 0, 100% 15px, 100% 100%, 0 100%, 0 15px);
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
}
/* a printed strip at the foot of the tag, sky blue once taken */
.tag-card::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; z-index: -1;
  background: var(--card-line); transition: background-color .3s ease, height .3s ease;
}
/* reinforced eyelet: a paper ring glued round a steel-rimmed hole that shows the wall behind */
.tag-eyelet {
  position: absolute; top: 5px; left: 50%; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%;
  background: radial-gradient(circle, var(--panel-2) 0 3.4px, var(--steel-lo) 3.6px 4.2px, var(--steel-hi) 4.5px 5.2px, var(--steel) 5.5px 5.9px, var(--card-2) 6.2px 9.2px, rgb(0 0 0 / .14) 9.4px 9.8px, transparent 10px);
}
.tag-knot {
  position: absolute; top: 2px; left: 50%; width: 10px; height: 7px; margin-left: -5px; border-radius: 3px; z-index: 3;
  background: var(--sky); box-shadow: 0 1px 2px rgb(0 0 0 / .35); scale: 0; transition: scale .3s cubic-bezier(.3, 1.6, .5, 1);
}
.tag-name { align-self: center; max-width: 100%; font-family: var(--serif); font-size: 1.1rem; line-height: 1.06; color: var(--card-ink); hyphens: auto; -webkit-hyphens: auto; }
.tag-n {
  width: 82%; padding-top: 6px; border-top: 1px solid var(--card-line);
  font-size: 0.72rem; font-weight: 600; line-height: 1.2; color: var(--card-muted); font-variant-numeric: tabular-nums;
}

@media (hover: hover) {
  .tag:hover { rotate: calc(var(--r) * -0.7); }
  .tag:hover .tag-card { translate: 0 -2px; }
}

/* taken off the wall: it straightens, comes forward, gets a sky-blue tie */
.tag[aria-pressed="true"] { rotate: 0deg; }
.tag[aria-pressed="true"] .tag-card {
  translate: 0 -5px; scale: 1.06;
  filter: drop-shadow(0 18px 16px rgb(0 0 0 / .5)) drop-shadow(0 2px 2px rgb(0 0 0 / .35));
}
.tag[aria-pressed="true"] .tag-card::after { background: var(--sky); height: 6px; }
.tag[aria-pressed="true"] .tag-cord path { stroke: var(--sky); stroke-width: 2.2; }
.tag[aria-pressed="true"] .tag-knot { scale: 1; }
.tag[aria-pressed="true"] .tag-n { color: var(--card-ink); }

/* the swing, once, after the hatch is up */
@media (prefers-reduced-motion: no-preference) {
  .gar.is-open:not(.is-settled) .tag { animation: tagSwing 2.1s cubic-bezier(.4, 0, .3, 1) calc(1.15s + var(--i) * 38ms) both; }
}
@keyframes tagSwing {
  0% { rotate: var(--r); }
  14% { rotate: calc(var(--r) + 10deg); }
  36% { rotate: calc(var(--r) - 6.5deg); }
  57% { rotate: calc(var(--r) + 3.2deg); }
  77% { rotate: calc(var(--r) - 1.2deg); }
  100% { rotate: var(--r); }
}

/* ---------- under the garage ---------- */

.gar-under { display: flex; justify-content: flex-start; min-height: 20px; margin-top: 14px; }
.gar-more { font-size: 0.9rem; }
.gar-out { margin-top: 18px; display: grid; gap: 24px; }
.gar-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px 32px; min-height: 56px; }
.gar-count { font-size: 1.05rem; color: var(--ink-2); max-width: 62ch; }
.gar-count.is-result { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; font-size: 1.15rem; color: var(--ink); }
.gar-count strong { font-family: var(--serif); font-weight: 400; font-size: clamp(2.6rem, 2rem + 1.6vw, 3.6rem); line-height: .9; }
.gar-count .btn-link { font-size: inherit; }

.gar-rail { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px; }
.gar-y { display: grid; gap: 6px; text-decoration: none; color: inherit; }
.gar-y-media { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--line); }
.gar-y-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s cubic-bezier(.16, 1, .3, 1); }
.gar-y:hover .gar-y-media img { transform: scale(1.04); }
.gar-y-name { font-family: var(--serif); font-size: 1.2rem; line-height: 1.1; }
.gar-y-meta { font-size: 0.8125rem; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .gar-rail li { animation: garIn .5s cubic-bezier(.16, 1, .3, 1) both; }
  .gar-rail li:nth-child(2) { animation-delay: 40ms; }
  .gar-rail li:nth-child(3) { animation-delay: 80ms; }
  .gar-rail li:nth-child(4) { animation-delay: 120ms; }
  .gar-rail li:nth-child(5) { animation-delay: 160ms; }
  .gar-rail li:nth-child(6) { animation-delay: 200ms; }
}
@keyframes garIn { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1000px) {
  .gar-rail { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(170px, 34%); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 4px; }
  .gar-rail::-webkit-scrollbar { display: none; }
  .gar-rail li { scroll-snap-align: start; }
}

/* ---------- phones: three tags a row, smaller ---------- */

@media (max-width: 600px) {
  .gar { padding: 12px 12px 14px; border-radius: 12px; }
  .gar-grip { width: 72px; margin-left: -36px; }
  .gar-bay { --pad: 10px; padding-top: 48px; }
  .gar-led { top: 30px; }
  .gar-wall { --pitch: 156px; --tagw: 94px; --tagh: 100px; --cordh: 26px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tag { margin-top: 18px; }
  .tag-card { padding: 25px 6px 9px; gap: 4px; }
  .tag-name { font-size: 0.98rem; }
  .tag-n { font-size: 0.6875rem; width: 88%; }
  .gar-rail { grid-auto-columns: minmax(150px, 46%); gap: 14px; }
  .gar-count.is-result { font-size: 1.05rem; }
}

/* ---------- small tags on the preference sheet ---------- */

.tags-small {
  --panel-2: #c9ced3;
  --cord: #8a939b;
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); grid-auto-rows: 118px;
  background: repeating-linear-gradient(180deg, transparent 0 10px, #9aa3ab 10px 11px, #d6dade 11px 13px, #8e979f 13px 14px, transparent 14px 118px);
}
.tags-small .tag-card { --tagw: 88px; --tagh: 78px; width: var(--tagw); height: var(--tagh); padding: 20px 5px 7px; gap: 3px;
  filter: drop-shadow(0 4px 4px rgb(20 30 40 / .22)) drop-shadow(0 1px 1px rgb(20 30 40 / .25)); }
.tags-small .tag-card::before { clip-path: polygon(11px 0, calc(100% - 11px) 0, 100% 11px, 100% 100%, 0 100%, 0 11px); background: linear-gradient(180deg, #fff, #f3f3ef); }
.tags-small .tag-card::after { height: 3px; }
.tags-small .tag { margin-top: 14px; }
.tags-small .peg::before { top: 7px; width: 4px; height: 12px; margin-left: -2px; box-shadow: 0 2px 2px rgb(20 30 40 / .3); }
.tags-small .tag-cord { --cordh: 18px; height: 18px; margin-bottom: -12px; }
.tags-small .tag-eyelet { top: 4px; width: 12px; height: 12px; margin-left: -6px;
  background: radial-gradient(circle, var(--panel-2) 0 2.6px, #69727b 2.9px 3.4px, #f4f6f8 3.7px 4.6px, #b7bec5 4.9px 5.5px, transparent 5.8px); }
.tags-small .tag-knot { top: 1px; width: 8px; height: 6px; margin-left: -4px; }
.tags-small .tag-name { font-size: 0.86rem; }
.tags-small .tag-n { font-size: 0.625rem; padding-top: 3px; width: 86%; }
.tags-small .tag[aria-pressed="true"] .tag-card { filter: drop-shadow(0 10px 9px rgb(20 30 40 / .3)) drop-shadow(0 1px 1px rgb(20 30 40 / .3)); }
