/* Digital business cards. Tokens from BRAND.md section 12, depth layer from the
   depth kit's depth-tokens.css. Fonts are the system installs of Baskerville and
   Helvetica Neue; no webfonts are licensed yet. */
:root {
  --ivory:  #F5F1E8;
  --ink:    #242824;
  --forest: #173F35;
  --brass:  #B49A64;
  --stone:  #D9D5CB;

  --serif: "Baskerville", "Baskerville Old Face", Georgia, serif;
  --sans:  "Helvetica Neue", Helvetica, Arial, sans-serif;

  --radius: 4px;
  --gutter: 24px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* Tonal values: only inside the falloff below, never as fills or text. */
  --forest-lift:  #1D4A3E;
  --forest-shade: #11302A;
  --brass-light:  #D8C08A;
  --brass-shade:  #8F7744;

  --brass-foil: linear-gradient(135deg, var(--brass-shade) 0%, var(--brass) 35%, var(--brass-light) 50%, var(--brass) 65%, var(--brass-shade) 100%);

  --surface-forest: radial-gradient(ellipse at 28% 22%, var(--forest-lift) 0%, var(--forest) 55%, var(--forest-shade) 100%);
  --grain-on-light: url("/brand/textures/grain-dark-tile.webp");
  --grain-on-dark:  url("/brand/textures/grain-light-tile.webp");
  --grain-size: 512px;
  --shadow-paper: 0 1px 2px rgba(36, 40, 36, 0.06), 0 12px 32px rgba(36, 40, 36, 0.08);
}

/* Every surface larger than a button carries grain (BRAND.md section 4). */
.surface-ivory, body {
  background-color: var(--ivory);
  background-image: var(--grain-on-light);
  background-size: var(--grain-size);
}
.surface-forest {
  background-color: var(--forest);
  background-image: var(--grain-on-dark), var(--surface-forest);
  background-size: var(--grain-size), cover;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font: 400 1.0625rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }

:focus-visible { outline: 2px solid var(--forest); outline-offset: 3px; }
.hero :focus-visible, .foot :focus-visible { outline-color: var(--ivory); }

.card {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Forest opening panel, the signature surface. */
.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  color: var(--ivory);
  padding: calc(env(safe-area-inset-top) + 20px) var(--gutter) 40px;
}

.bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

/* The brushed stacked lockup leads: Takumi uses brush work wherever the mark
   appears on this card. The negative inline margin trims the file's own side
   padding so the lockup lines up with the text column. */
.logo { width: 176px; margin: 0 0 0 -6px; }

.share {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--stone);
  border-radius: var(--radius);
  background: none;
  color: var(--ivory);
  cursor: pointer;
}
.share { transition: border-color 0.3s var(--ease); }
.share:hover { border-color: var(--brass); }

/* Narrower than the column on purpose: the asymmetry is the brand's, and it keeps
   Save contact above the fold on a phone. */
.portrait {
  margin: 0 0 32px;
  width: 56%;
  max-width: 208px;
  overflow: hidden;
  border-radius: var(--radius);
}
.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 8%;
  scale: 1.08;
}

.hero h1 {
  margin: 0;
  font: 400 clamp(2.5rem, 11vw, 3rem)/1.1 var(--serif);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.role {
  margin: 24px 0 0;
  padding-top: 16px;
  position: relative;
  width: fit-content;
  min-width: 96px;
  font: 500 1rem/1.3 var(--sans);
  color: var(--ivory);
}

.place {
  margin: 4px 0 0;
  font-size: 0.9375rem;
  color: var(--stone);
}

/* Ivory body: the one action, then the details. */
.contact { padding: 32px var(--gutter) 8px; }

.save {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 20px;
  border-radius: var(--radius);
  background: var(--forest);
  color: var(--ivory);
  font: 500 1rem/1 var(--sans);
  text-decoration: none;
}
.save { transition: background-color 0.3s var(--ease), transform 0.15s var(--ease); }
.save:hover { background: var(--ink); }
.save:active { transform: translateY(1px); }

.quick {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.act {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 76px;
  border: 1px solid var(--stone);
  border-radius: var(--radius);
  color: var(--ink);
  font: 500 0.875rem/1.2 var(--sans);
  text-decoration: none;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease), transform 0.15s var(--ease);
}
.act svg { color: var(--forest); }
.act:hover { border-color: var(--forest); color: var(--forest); }
.act:active { transform: translateY(1px); }

.sec {
  margin: 40px 0 8px;
  font: 500 0.75rem/1.3 var(--sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.rows { list-style: none; margin: 0; padding: 0; }

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--stone);
}
.row:first-child { border-top: 1px solid var(--stone); }

.row > a {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  text-decoration: none;
}
.ico { flex: none; display: grid; color: var(--forest); }
.txt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.go {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 500 0.875rem/1 var(--sans);
  color: var(--forest);
  padding-right: 4px;
}
.row > a .val, .group .name {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.3s var(--ease);
}
.row > a:hover .val, .group a:hover .name { text-decoration-color: currentColor; }

.lab { font-size: 0.8125rem; line-height: 1.4; }

.val { font-size: 1.0625rem; overflow-wrap: anywhere; }

.copy {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.copy { transition: background-color 0.2s var(--ease); }
.copy:hover { background: var(--stone); }
.copy .ok, .copy.done .cp { display: none; }
.copy.done .ok { display: block; }

.about { padding: 48px var(--gutter) 56px; }

.about h2 {
  margin: 0 0 16px;
  font: 400 1.875rem/1.2 var(--serif);
  color: var(--forest);
}

.about p { margin: 0; max-width: 34em; }

.about h3 {
  margin: 32px 0 12px;
  font: 500 0.75rem/1.3 var(--sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.group {
  list-style: none;
  margin: 0;
  padding: 24px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px 24px;
  position: relative;
}
.group a { display: block; text-decoration: none; }

/* Logos sit on a shared baseline at matched optical size; the name under each
   carries the identity, so a symbol only still reads. */
.logo-box { height: 40px; display: flex; align-items: flex-end; }
.logo-box img { width: auto; height: auto; max-height: 34px; max-width: 100%; }
.logo-box img.tall { max-height: 40px; }
.group .name {
  display: block;
  margin-top: 10px;
  font-size: 0.8125rem;
  line-height: 1.4;
}

/* Forest close, built as the back of the printed card: the brushed emblem, which
   needs 160px or more to hold its brush detail. */
.foot {
  margin-top: auto;
  color: var(--stone);
  padding: 64px var(--gutter) calc(env(safe-area-inset-bottom) + 48px);
  font-size: 0.8125rem;
  line-height: 1.4;
  text-align: center;
}
.foot img { width: 176px; margin: 0 auto 40px; }
.foot p { margin: 0; }
.ext { display: inline; vertical-align: -1px; margin-left: 2px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 24px);
  transform: translateX(-50%);
  padding: 12px 18px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--ivory);
  font: 500 0.9375rem/1.3 var(--sans);
  white-space: nowrap;
}
.toast[hidden] { display: none; }
.toast { animation: toast-in 0.35s var(--ease) both; }
.toast.out { animation: toast-out 0.2s ease-in both; }

/* On a wide screen the card is a sheet of ivory resting on stone. */
@media (min-width: 520px) {
  body { background-color: var(--stone); padding: 40px 0; }
  .card {
    min-height: auto;
    background-color: var(--ivory);
    background-image: var(--grain-on-light);
    background-size: var(--grain-size);
    box-shadow: var(--shadow-paper);
  }
}

/* The enso. Brush work is painted in the way it was made: one clockwise stroke.
   The sweep is a registered angle so it can animate; where it cannot, it rests at
   380deg, past the soft 12deg tail, so the mark always ends whole. */
@property --sweep {
  syntax: "<angle>";
  inherits: false;
  initial-value: 380deg;
}
.brush, .enso {
  -webkit-mask-image: conic-gradient(from -40deg, #000 calc(var(--sweep) - 12deg), transparent var(--sweep));
          mask-image: conic-gradient(from -40deg, #000 calc(var(--sweep) - 12deg), transparent var(--sweep));
}

/* Tone on tone brush: the brushed emblem, cropped off the edge, once per piece
   and below the logo (BRAND.md section 4). Ivory at a low opacity rather than
   forest lift, so it reads on a phone screen; still tone on tone. */
.brush {
  position: absolute;
  z-index: -1;
  top: 200px;
  right: -46%;
  width: 128%;
  max-width: 560px;
  aspect-ratio: 390 / 300;
  pointer-events: none;
}
.brush i {
  position: absolute;
  inset: 0;
  background: var(--ivory);
  opacity: 0.09;
  -webkit-mask: url("/brand/emblem-brushed-tone.svg") center / contain no-repeat;
          mask: url("/brand/emblem-brushed-tone.svg") center / contain no-repeat;
}

/* Brass rules are drawn as lines so they can be drawn in. */
.role::before, .group::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--brass);
  transform-origin: left center;
}
/* Rules of 2px and up carry the brass foil (BRAND.md section 6). */
.role::before {
  height: 2px;
  background: var(--brass-foil);
  background-size: 300% 100%;
  background-position: 100% 0;
}

/* Motion. One quiet arrival when the card opens, then sections settle in as they
   reach the screen. Everything is visible without it: the keyframes only hold a
   from state, so if animation is off or unsupported nothing stays hidden. */
@keyframes rise   { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade   { from { opacity: 0; } }
@keyframes draw   { from { transform: scaleX(0); } }
@keyframes unveil { from { clip-path: inset(0 0 100% 0); } }
@keyframes settle { from { transform: scale(1.06); } }
@keyframes tick   { from { stroke-dashoffset: 23; } }
@keyframes sheen  { from { background-position: 100% 0; } to { background-position: 0% 0; } }
@keyframes paint  { from { --sweep: 0deg; } }
@keyframes ink    { from { opacity: 0; letter-spacing: 0.05em; } }
@keyframes toast-in  { from { opacity: 0; transform: translate(-50%, 10px); } }
@keyframes toast-out { to   { opacity: 0; transform: translate(-50%, 6px); } }

.bar           { animation: fade 0.9s var(--ease) both; }
.portrait      { animation: unveil 1.2s var(--ease) 0.1s both; }
.portrait img  { animation: settle 1.8s var(--ease) 0.1s both; }
.hero h1       { animation: ink 1.4s var(--ease) 0.35s both; }
.brush         { animation: paint 2.8s cubic-bezier(0.5, 0, 0.2, 1) 0.4s both; }
.role::before  { animation: draw 1s var(--ease) 0.55s both, sheen 2.4s ease-in-out 1.4s both; }
.role          { animation: rise 0.8s var(--ease) 0.6s both; }
.place         { animation: rise 0.8s var(--ease) 0.68s both; }
.save          { animation: rise 0.8s var(--ease) 0.8s both; }
.act           { animation: rise 0.7s var(--ease) both; }
.act:nth-child(1) { animation-delay: 0.88s; }
.act:nth-child(2) { animation-delay: 0.94s; }
.act:nth-child(3) { animation-delay: 1s; }
.sec, .row     { animation: rise 0.7s var(--ease) 1.08s both; }
.row:nth-child(2) { animation-delay: 1.14s; }
.row:nth-child(3) { animation-delay: 1.2s; }

/* The tick draws itself when a copy lands. */
.copy .ok path { stroke-dasharray: 23; }
.copy.done .ok path { animation: tick 0.4s var(--ease) both; }

/* Below the fold, tied to scroll where the browser supports it. */
/* Depth on scroll. The hero's grain travels slower than the content and the
   photo shifts inside its frame, so the card reads as content resting on a
   surface. The brushed emblem never moves: the mark stays fixed to the card.
   Tied to the page scroll, so it stops when scrolling stops; off with reduced
   motion. */
@keyframes drift-ground { to { background-position: 0 160px, 0 0; } }
@keyframes drift-photo { from { translate: 0 10px; } to { translate: 0 -14px; } }

@supports (animation-timeline: scroll()) {
  .hero {
    animation: drift-ground linear both;
    animation-timeline: scroll(root);
    animation-range: 0 700px;
  }
  .portrait img {
    animation: settle 1.8s var(--ease) 0.1s both, drift-photo linear both;
    animation-timeline: auto, scroll(root);
    animation-range: normal, 0 600px;
  }
}

@supports (animation-timeline: view()) {
  .about h2, .about p, .about h3, .group li, .foot img, .foot p {
    animation: rise linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 90%;
  }
  .group li:nth-child(even) { animation-range: entry 15% entry 100%; }
  .group::before {
    animation: draw linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 30%;
  }
  .foot p { animation-name: fade; }
  .foot .enso { animation: none; }
}

/* The footer enso is painted once, on a clock rather than on scroll, so it can
   never be left half drawn. card.js marks it when it comes into view; without
   the script it simply shows whole. */
@media (prefers-reduced-motion: no-preference) {
  .js .foot .enso:not(.in) { --sweep: 0deg; }
  .js .foot .enso.in { animation: paint 2.4s cubic-bezier(0.5, 0, 0.2, 1) 0.15s both; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
