/* ==========================================================================
   leart. — portfolio keyboard
   ==========================================================================
   1. Tokens
   2. Base
   3. Header
   4. Hero
   5. Keyboard
   6. Marquee
   7. Contact + footer
   8. Dialogs + buttons
   9. Reduced motion
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --ink: #111111;
  --text: #241c32;
  --accent: #d96c9c;
  --accent-light: #ff9ec8;
  --teal: #0c5a5c;
  --on-teal: #f1fbfa;
  --gold: #ffdfa0;
  --brown: #8b4d20;

  --font-display: "Satoshi", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: Georgia, "Times New Roman", Times, serif;

  --pad: clamp(48px, 6vw, 112px);
  --header-h: 73px;
  --ease-out: cubic-bezier(0.22, 0.8, 0.3, 1);
}

@media (max-width: 1024px) {
  :root { --pad: 32px; }
}

@media (max-width: 600px) {
  :root { --pad: 22px; }
}

/* 2. Base ------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

html:has(dialog[open]) {
  overflow: hidden;
}

body {
  margin: 0;
  font-family: var(--font-body);
  line-height: 1.5;
  color: var(--text);
  background:
    linear-gradient(168deg, #fff7fb 0, #ffffff 420px, #f1f0ff 900px) no-repeat,
    #f1f0ff;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  padding: 10px 16px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
}

.skip-link:focus-visible {
  transform: none;
}

/* 3. Header ---------------------------------------------------------------- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 14px var(--pad);
  border-bottom: 1px solid rgb(36 28 50 / 0.1);
}

.wordmark {
  display: inline-block;
  padding: 6px 0;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.055em;
  color: var(--text);
  text-decoration: none;
}

.wordmark__dot {
  color: var(--accent);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.nav-link:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.nav-link--cta {
  margin-left: 6px;
  padding: 0 18px;
  border: 2px solid var(--ink);
  background: #fff;
  font-weight: 600;
  color: var(--ink);
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.nav-link--cta:hover {
  text-decoration: none;
  background: #ffe446;
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}

@media (max-width: 600px) {
  .wordmark { font-size: 26px; }
  .nav-link { padding: 0 8px; font-size: 14px; }
  .nav-link--cta { margin-left: 2px; padding: 0 14px; }
}

/* 4. Hero ------------------------------------------------------------------ */
/* On desktop the hero fills the first screen: headline at the top, keyboard
   centred in the remaining space, marquee along the bottom edge. Narrower
   screens let it follow its content so the keyboard doesn't float. */
.hero {
  display: flex;
  flex-direction: column;
}

@media (min-width: 901px) {
  .hero { min-height: calc(100svh - var(--header-h)); }
}

.hero__inner {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: clamp(32px, 6vh, 88px) var(--pad) 0;
}

.hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(38px, 2.6vw + 24px, 76px);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.045em;
  color: var(--text);
}

.hero__line {
  display: block;
}

.hero__title em {
  padding-right: 0.04em;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--accent);
}

/* 5. Keyboard -------------------------------------------------------------- */
/* The composition is authored on a 900 × 312 grid. --u is one grid unit:
   1px at full size, smaller when the container is narrower than 900px.
   Auto margins centre it in the hero's spare height; the padding keeps a
   minimum gap and reserves room for focus rings and the hard shadow. */
.keyboard {
  container-type: inline-size;
  margin-block: auto;
  padding: clamp(36px, 7vh, 96px) 10px clamp(32px, 6vh, 80px);
}

.keyboard__stage {
  --u: min(1px, calc(100cqw / 900));
  position: relative;
  width: calc(900 * var(--u));
  height: calc(312 * var(--u));
  margin-inline: auto;
}

.key {
  --by: 0;   /* base travel, in grid units */
  --fy: 0;   /* face travel relative to the base, in grid units */
  --t: 180ms;
  --line: max(1px, calc(2 * var(--u)));
  position: absolute;
  z-index: 1;
  left: calc((var(--x) + 12) * var(--u));
  top: calc(var(--y) * var(--u));
  display: block;
  width: calc(146 * var(--u));
  height: calc(161 * var(--u));
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: var(--line) solid var(--ink);
  border-radius: calc(38 * var(--u));
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--base) 82%, #fff) 0%,
    var(--base) 34%,
    color-mix(in srgb, var(--base) 70%, #000) 100%
  );
  box-shadow:
    0 calc((5 - var(--by)) * var(--u)) 0 var(--ink),
    inset 0 calc(2 * var(--u)) 0 rgb(255 255 255 / 0.35);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transform: translateY(calc(var(--by) * var(--u)));
  transition:
    transform var(--t) var(--ease-out),
    box-shadow var(--t) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.key--lower {
  z-index: 2;
}

.key--enter {
  width: calc(218 * var(--u));
  height: calc(300 * var(--u));
}

.key:focus-visible {
  z-index: 4;
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

/* Angled seams between face and base; sit beneath the face. */
.key__seams {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.key__seams::before,
.key__seams::after {
  content: "";
  position: absolute;
  top: calc(104 * var(--u));
  width: max(1px, calc(1.5 * var(--u)));
  height: calc(46 * var(--u));
  background: rgb(17 17 17 / 0.5);
  transform-origin: top center;
}

.key__seams::before {
  left: calc(16 * var(--u));
  transform: rotate(17deg);
}

.key__seams::after {
  right: calc(16 * var(--u));
  transform: rotate(-17deg);
}

.key--enter .key__seams::before,
.key--enter .key__seams::after {
  top: calc(243 * var(--u));
}

.key__face {
  position: absolute;
  inset: calc(3 * var(--u)) calc(8 * var(--u)) calc(31 * var(--u));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(13 * var(--u)) calc(7 * var(--u)) calc(12 * var(--u));
  border: var(--line) solid var(--ink);
  border-radius: calc(29 * var(--u));
  background: radial-gradient(
    130% 100% at 28% 10%,
    color-mix(in srgb, var(--face) 50%, #fff) 0%,
    var(--face) 58%
  );
  box-shadow: inset 0 calc(-5 * var(--u)) 0 rgb(0 0 0 / 0.07);
  transform: translateY(calc(var(--fy) * var(--u)));
  transition: transform var(--t) var(--ease-out);
  pointer-events: none;
}

.key__letter {
  font-family: var(--font-display);
  font-size: calc(74 * var(--u));
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.04em;
}

.key__caption {
  max-width: 100%;
  font-family: var(--font-body);
  font-size: calc(10.5 * var(--u));
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.05em;
  text-align: center;
  text-transform: uppercase;
}

.key--enter .key__face {
  display: block;
}

.key__arrow {
  position: absolute;
  top: calc(30 * var(--u));
  left: calc(54 * var(--u));
  width: calc(96 * var(--u));
  height: calc(96 * var(--u));
}

.key__caption--vertical {
  position: absolute;
  right: calc(14 * var(--u));
  bottom: calc(18 * var(--u));
  font-size: calc(11.5 * var(--u));
  letter-spacing: 0.1em;
  writing-mode: vertical-rl;
  text-orientation: sideways;
}

/* States: hover/focus sink the face; auto-press and :active move the base too. */
@media (hover: hover) {
  .key:hover { --fy: 8; }
}

.key:focus-visible { --fy: 8; }

.key.is-pressed {
  --by: 4;
  --fy: 9;
  --t: 120ms;
}

.key:active {
  --by: 5;
  --fy: 9;
  --t: 90ms;
}

/* 6. Marquee --------------------------------------------------------------- */
.marquee {
  overflow: hidden;
  padding-block: 9px;
  border-block: 1.5px solid var(--ink);
  background: var(--gold);
  color: var(--brown);
}

.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee var(--marquee-duration, 90s) linear infinite;
}

.marquee__group {
  --gap: clamp(20px, 2vw, 32px);
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--gap);
  padding-right: var(--gap);
}

.marquee__item {
  font-family: var(--font-serif);
  font-size: clamp(15px, 0.4vw + 12px, 19px);
  font-style: italic;
  line-height: 1.3;
  white-space: nowrap;
}

.marquee__sep {
  font-size: 12px;
  line-height: 1;
}

@keyframes marquee {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}

/* 7. Contact + footer ------------------------------------------------------ */
.contact,
.site-footer {
  background: var(--teal);
  color: var(--on-teal);
}

.contact :focus-visible,
.site-footer :focus-visible {
  outline-color: #fff;
}

.contact {
  padding: clamp(72px, 10vw, 150px) var(--pad);
}

.contact__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: end;
  gap: clamp(32px, 5vw, 80px);
}

.contact__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(38px, 2.8vw + 24px, 80px);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.contact__line {
  display: block;
}

.contact__title em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--accent-light);
}

.contact__text {
  max-width: 30ch;
  margin: 0 0 20px;
  font-size: clamp(18px, 0.6vw + 14px, 22px);
  line-height: 1.5;
  color: rgb(241 251 250 / 0.84);
}

.contact__email {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(22px, 1.8vw + 10px, 38px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--accent-light);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
}

.contact__email:hover {
  color: #fff;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 22px var(--pad) 28px;
  border-top: 1px solid rgb(241 251 250 / 0.16);
  font-size: 14px;
  color: rgb(241 251 250 / 0.76);
}

.site-footer p {
  margin: 0;
}

.site-footer__top {
  text-decoration: none;
}

.site-footer__top:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (max-width: 860px) {
  .contact__inner {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }
}

/* 8. Dialogs + buttons ----------------------------------------------------- */
.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: auto;
  border: 2px solid var(--ink);
  border-radius: 28px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 6px 0 var(--ink);
}

.dialog[open] {
  animation: dialog-in 220ms var(--ease-out);
}

.dialog::backdrop {
  background: rgb(6 40 41 / 0.5);
  backdrop-filter: blur(3px);
}

.dialog__panel {
  padding: clamp(24px, 4vw, 40px);
  border-top: 14px solid var(--dialog-accent);
}

.dialog__title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(30px, 2vw + 20px, 42px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.dialog__lead {
  margin: 0 0 12px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

.dialog__text {
  margin: 0 0 16px;
  font-size: 17px;
  line-height: 1.6;
}

.dialog__impact {
  margin: 0 0 16px;
  padding-left: 12px;
  border-left: 4px solid var(--dialog-accent);
  font-family: var(--font-serif);
  font-size: 18px;
  font-style: italic;
  line-height: 1.45;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag-list li {
  padding: 5px 12px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.work-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.work-list__item {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1.5px solid rgb(17 17 17 / 0.16);
  border-radius: 14px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.work-list__item:hover {
  border-color: var(--ink);
  background: #fff7fb;
}

.work-list__title {
  font-weight: 700;
  color: var(--ink);
}

.work-list__summary {
  font-size: 14px;
  line-height: 1.4;
  color: rgb(36 28 50 / 0.75);
}

.dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: 48px;
  padding: 0 22px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.button:hover {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}

.button--primary {
  background: var(--dialog-accent, #ffe446);
}

.button--ghost {
  background: #fff;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* 9. Reduced motion -------------------------------------------------------- */
/* No automatic movement; the marquee becomes one static, wrapping message. */
@media (prefers-reduced-motion: reduce) {
  .key,
  .key__face,
  .nav-link--cta,
  .button {
    transition-duration: 1ms;
  }

  .dialog[open] {
    animation: none;
  }

  .marquee__track {
    width: 100%;
    animation: none;
  }

  .marquee__group {
    flex-shrink: 1;
    justify-content: center;
    width: 100%;
    padding-inline: var(--pad);
  }

  .marquee__group[aria-hidden="true"],
  .marquee__item[aria-hidden="true"],
  .marquee__sep {
    display: none;
  }

  .marquee__item {
    white-space: normal;
    text-align: center;
  }
}
