/* ==========================================================================
   Apcylon — landing page
   Colors, type and spacing are defined once here as custom properties.
   ========================================================================== */

:root {
  /* Brand palette */
  --color-bg: #0B0D0F;          /* main background */
  --color-text: #F4F2EC;        /* main text, matches the light wordmark */
  --color-text-muted: #A7ABB1;  /* secondary text */
  --color-divider: #2A2F35;     /* subtle dividers */
  --color-ink: #111111;         /* black wordmark reference */
  --color-white: #FFFFFF;

  /* Type */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --text-label: 0.75rem;
  --text-body: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lead: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  --text-headline: clamp(2.25rem, 1.4rem + 3.4vw, 4.5rem);
  --text-h2: clamp(1.25rem, 1.1rem + 0.6vw, 1.625rem);

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --space-9: 7rem;

  /* Layout */
  --container-max: 82.5rem;               /* 1320px */
  --gutter: clamp(1rem, 0.4rem + 3vw, 3rem);
  --radius: 2px;
  --focus: 2px solid var(--color-text);

  /* Wordmark geometry (from the SVG viewBox 1011.7 × 291).
     The artwork has ~24.5 units of padding on every side; these values let the
     ink align exactly with the text column without altering the file. */
  --wm-ink-ratio: 1.0509;   /* full width ÷ ink width (1011.7 / 962.7) */
  --wm-pad-ratio: 0.02431;  /* side padding ÷ full width (24.6 / 1011.7) */
}

/* --- Base --------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--color-bg);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

:focus { outline: none; }
:focus-visible {
  outline: var(--focus);
  outline-offset: 4px;
  border-radius: var(--radius);
}

::selection { background: var(--color-text); color: var(--color-bg); }

.container {
  width: 100%;
  max-width: calc(var(--container-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  z-index: 10;
  padding: var(--space-3) var(--space-4);
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 0.875rem;
  transform: translateY(-200%);
}
.skip-link:focus-visible { transform: none; outline-color: var(--color-text); }

.label {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* --- Hero --------------------------------------------------------------- */

.hero {
  /* Fill the first screen, but never stretch into a void on very tall displays. */
  min-height: min(100vh, 64rem);
  min-height: min(100svh, 64rem);
  display: flex;
}

.hero__inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-7);
  padding-block: var(--space-6) var(--space-8);
}

.hero__top {
  display: grid;
  grid-template-columns: 1fr minmax(0, 1.6fr);
  align-items: start;
  gap: var(--space-6);
}

.hero__top .label {
  padding-top: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.hero__top .label::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border: 1px solid var(--color-text-muted);
  flex: none;
}

/* Wordmark: ink spans the full text column; proportions are always preserved. */
.wordmark {
  margin-top: auto;
}
.wordmark img {
  width: calc(100% * var(--wm-ink-ratio));
  max-width: none;
  height: auto;
  aspect-ratio: 1011.7 / 291;
  margin-inline-start: calc(-100% * var(--wm-ink-ratio) * var(--wm-pad-ratio));
  /* Trim the artwork's vertical padding visually, without cropping the file. */
  margin-block: calc(-100% * var(--wm-ink-ratio) * 0.024);
}

.hero__body {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: var(--space-6) var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
}

.headline {
  font-size: var(--text-headline);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.025em;
  max-width: 13ch;
  text-wrap: balance;
}

.hero__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  padding-top: var(--space-2);
  max-width: 34rem;
}

.lead {
  font-size: var(--text-lead);
  line-height: 1.45;
  color: var(--color-text);
  text-wrap: pretty;
}

.note {
  color: var(--color-text-muted);
  text-wrap: pretty;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 3rem;
  margin-top: var(--space-4);
  padding: 0 var(--space-5);
  border: 1px solid var(--color-text);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-bg);
  background: var(--color-text);
  transition: background-color 160ms ease, color 160ms ease;
}
.button:hover {
  background: transparent;
  color: var(--color-text);
}
.button__arrow { font-family: var(--font-sans); letter-spacing: 0; }

/* --- Instrument (decorative) --------------------------------------------
   One control loop per cycle:
   0–60%   a scan line sweeps left → right; each bar is excited as it passes
           and decays behind it like a phosphor trace. OUT registers.
   60–96%  a feedback pulse travels back along the baseline, OUT → IN.
   Bar delays are derived from each bar's x position (--f), so the field
   stays in sync with the scan line at every viewport width.             */

.instrument {
  --cycle: 8s;
  --sweep: 4.8s;            /* 60% of --cycle */
  --i-top: 1.75rem;         /* top of the measurement area (below ruler) */
  --i-base: 1.75rem;        /* distance of the baseline from the bottom */
  position: relative;
  height: clamp(8.5rem, 7rem + 3vw, 10.5rem);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  pointer-events: none;
  user-select: none;
  overflow: hidden;          /* fallback */
  overflow: clip;            /* moving layers must never widen the page */
  overflow-clip-margin: 0.5rem;
}

.instrument__nums {
  position: absolute;
  inset: 0 0 auto 0;
  height: 0.625rem;
}
.instrument__nums span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
}
.instrument__nums span:first-child { transform: none; }

.instrument__ruler {
  position: absolute;
  top: 1rem;
  left: 0;
  width: 100%;
  height: 0.5rem;
  overflow: visible;
}
.instrument__ruler line {
  stroke: var(--color-text-muted);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  opacity: 0.55;
}

.instrument__field {
  position: absolute;
  top: calc(var(--i-top) + 0.75rem);
  bottom: calc(var(--i-base) + 0.75rem);
  left: 0;
  width: 100%;
  height: auto;
  overflow: visible;
}
.instrument__field line {
  stroke: var(--color-text);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  opacity: 0.18;
  transform-box: fill-box;
  transform-origin: center;
  animation: inst-excite var(--cycle) cubic-bezier(0.2, 0.6, 0.3, 1) infinite none;
  animation-delay: calc(var(--f) * var(--sweep));
}

/* Scan line with a solid head; it spans ruler to baseline. */
.instrument__scan {
  position: absolute;
  top: 1rem;
  bottom: var(--i-base);
  left: 0;
  width: 100%;
  animation: inst-scan var(--cycle) linear infinite;
}
.instrument__scan::before,
.instrument__scan::after {
  content: "";
  position: absolute;
  left: 0;
  background: var(--color-text);
}
.instrument__scan::before { top: 0; bottom: 0; width: 1px; }
.instrument__scan::after  { top: -2px; width: 5px; height: 5px; margin-left: -2px; }

/* Baseline + feedback pulse (clipped to the track). */
.instrument__loop {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--i-base);
  overflow: hidden;
}
.instrument__loop::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: var(--color-divider);
}
.instrument__fb {
  position: absolute;
  inset: 0;
  animation: inst-feedback var(--cycle) linear infinite;
}
.instrument__fb::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3.5rem;
  height: 1px;
  background: var(--color-text);
}
.instrument__fb::after {
  content: "\2190\00a0 Feedback";
  position: absolute;
  top: 0.6875rem;
  left: 0;
  white-space: nowrap;
  color: var(--color-text);
}

.instrument__node {
  position: absolute;
  bottom: calc(var(--i-base) - 0.25rem + 0.5px);
  width: 0.5rem;
  height: 0.5rem;
  border: 1px solid var(--color-text-muted);
  background: var(--color-bg);
}
.instrument__node--in  { left: 0; animation: inst-node-in var(--cycle) steps(1, end) infinite; }
.instrument__node--out { right: 0; animation: inst-node-out var(--cycle) steps(1, end) infinite; }

.instrument__legend { position: absolute; bottom: 0; }
.instrument__legend--in  { left: 0; }
.instrument__legend--out { right: 0; }

@keyframes inst-excite {
  0%   { opacity: 1;    transform: scaleY(1.3); }
  3%   { opacity: 0.85; transform: scaleY(1.15); }
  22%  { opacity: 0.18; transform: scaleY(1); }
  100% { opacity: 0.18; transform: scaleY(1); }
}

@keyframes inst-scan {
  0%      { transform: translateX(0);    opacity: 1; }
  60%     { transform: translateX(100%); opacity: 1; }
  60.1%, 100% { transform: translateX(100%); opacity: 0; }
}

@keyframes inst-feedback {
  0%, 60% { transform: translateX(100%); opacity: 0; }
  62%     { opacity: 1; }
  92%     { opacity: 1; }
  96%     { transform: translateX(0);    opacity: 0; }
  100%    { transform: translateX(0);    opacity: 0; }
}

@keyframes inst-node-out {
  0%   { background: var(--color-bg); }
  60%  { background: var(--color-text); }
  72%  { background: var(--color-bg); }
}
@keyframes inst-node-in {
  0%   { background: var(--color-text); }
  8%   { background: var(--color-bg); }
  96%  { background: var(--color-text); }
}

/* Feedback label would collide with IN/OUT on very narrow tracks. */
@media (max-width: 420px) {
  .instrument__nums span:nth-child(even) { visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  /* A single frozen frame of the same loop. */
  .instrument__field line { animation: none; opacity: var(--o, 0.18); }
  .instrument__scan { animation: none; transform: translateX(var(--scan-at)); }
  .instrument__fb, .instrument__node { animation: none; }
  .instrument__fb { display: none; }
  .instrument__node--out { background: var(--color-text); }
  .button { transition: none; }
}

/* --- Founders ----------------------------------------------------------- */

.founders {
  border-top: 1px solid var(--color-divider);
  scroll-margin-top: 0;
}
.founders:focus { outline: none; }

.founders__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr);
  gap: var(--space-6) var(--space-8);
  padding-block: var(--space-8) var(--space-9);
}

.founders__heading {
  font-size: var(--text-h2);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.founder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.6fr) auto;
  align-items: baseline;
  gap: var(--space-2) var(--space-5);
  padding-block: var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}
.founder:first-child { border-top: 1px solid var(--color-divider); }

.founder__name {
  font-size: var(--text-lead);
  font-weight: 500;
  line-height: 1.3;
}

.founder__role {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.founder__links {
  display: grid;
  /* Fixed email column keeps both LinkedIn links aligned. */
  grid-template-columns: 16rem auto;
  align-items: baseline;
  gap: var(--space-1) var(--space-5);
}

.founder__links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;          /* comfortable touch target */
  overflow-wrap: anywhere;
  text-decoration-color: var(--color-divider);
  transition: text-decoration-color 160ms ease;
}
.founder__links a:hover { text-decoration-color: var(--color-text); }
.founder__links a[href^="https"] { color: var(--color-text-muted); }
.founder__links a[href^="https"]:hover { color: var(--color-text); }

.ext { margin-left: 0.3em; font-size: 0.9em; }

/* --- Footer ------------------------------------------------------------- */

.footer { border-top: 1px solid var(--color-divider); }

.footer__inner {
  padding-block: var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 1080px) {
  .founders__inner { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .hero__body { grid-template-columns: 1fr; }
  .headline { max-width: 14ch; }
}

@media (max-width: 820px) {
  .founder { grid-template-columns: 1fr auto; }
  .founder__links { grid-column: 1 / -1; grid-template-columns: auto auto; justify-content: start; }
  .founder__role { justify-self: end; }
}

@media (max-width: 720px) {
  .hero__top { grid-template-columns: 1fr; gap: var(--space-6); }
  .hero__inner { gap: var(--space-6); padding-bottom: var(--space-7); }
  .founders__inner { padding-block: var(--space-7) var(--space-8); }
}

@media (max-width: 380px) {
  .founder { grid-template-columns: 1fr; }
  .founder__role { justify-self: start; }
  .founder__links { grid-template-columns: 1fr; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .founder__links a { transition: none; }
}
