/* ==========================================================================
   Porthole marketing page
   Plain CSS, no build step. Sections:
     1. Fonts
     2. Tokens (light, then dark)
     3. Base
     4. Shared pieces (container, type helpers, buttons, cards, code, tag)
     5. Nav
     6. Hero and device mock-ups
     7. How it works
     8. What it does
     9. Also from Evil Teddy
    10. Install
    11. Footer
   ========================================================================== */


/* 1. Fonts ------------------------------------------------------------------
   Self-hosted latin subsets (SIL OFL, licences in fonts/). */

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/space-grotesk-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/space-grotesk-latin-500-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/space-grotesk-latin-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
}


/* 2. Tokens ----------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  /* Type */
  --font-ui: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --fs-11: 0.6875rem;
  --fs-12: 0.75rem;
  --fs-13: 0.8125rem;
  --fs-14: 0.875rem;
  --fs-15: 0.9375rem;
  --fs-16: 1rem;
  --fs-17: 1.0625rem;
  --fs-18: 1.125rem;
  --fs-20: 1.25rem;
  /* Fluid sizes: the artboard value from about 1100px up, smaller on phones. */
  --fs-lede: clamp(1.125rem, 1.05rem + 0.3vw, 1.25rem);     /* 18 to 20 */
  --fs-h2-small: clamp(1.5rem, 1.3rem + 0.85vw, 1.875rem);  /* 24 to 30 */
  --fs-h2: clamp(1.75rem, 1.5rem + 1.1vw, 2.25rem);         /* 28 to 36 */
  --fs-h1: clamp(2.375rem, 1.7rem + 2.97vw, 3.75rem);       /* 38 to 60 */

  /* Palette (light) */
  --bg: #EEEDE8;
  --bg2: #E4E2DB;
  --raised: #F5F4F0;
  --panel: #FFFFFF;
  --fg: #1A1A1A;
  --muted: #5C5A55;
  --line: #D6D4CC;
  --accent: #0F6E8C;
  --accent-hover: #0B556C;
  --lit: #1593B8;
  --ok: #2F7A4F;
  --danger: #B42318;
  --screen: #0F0F0E;
  --screen-text: #D9D6CE;

  /* Ink: the dark palette, used as-is on surfaces that are dark in both
     themes (the features band, the inverse card, the device mock-ups). */
  --ink-bg: #161614;
  --ink-bg2: #1F1F1C;
  --ink-panel: #242421;
  --ink-fg: #F0EEE8;
  --ink-muted: #A5A29A;
  --ink-line: #3A3934;
  --ink-accent: #4CC3E0;
  --ink-accent-hover: #7DD3EA;

  /* Roles that differ between themes */
  --btn-primary-hover: #33322F;
  --band-bg: var(--ink-bg);
  --code-bg: #1A1A1A;
  --inverse-bg: #1A1A1A;
  --inverse-line: #1A1A1A;
  --device-frame: #1A1A1A;
  --device-shadow: rgba(26, 26, 26, 0.25);
  --key-bg: var(--ink-bg);
  /* Switchboard's orange. The artboard has #C2410C, which is 4.42:1 on --bg;
     this is the nearest shade that clears 4.5:1 (4.65:1). */
  --switchboard: #BC3F0C;

  /* Layout */
  --page-max: 1280px;
  /* 6% side padding as in the artboard, never under 20px, and held at the
     artboard's 1440px value on wider screens. */
  --gutter: clamp(20px, 6%, 86.4px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--ink-bg);
    --bg2: var(--ink-bg2);
    --raised: var(--ink-panel);
    --panel: var(--ink-panel);
    --fg: var(--ink-fg);
    --muted: var(--ink-muted);
    --line: var(--ink-line);
    --accent: var(--ink-accent);
    --accent-hover: var(--ink-accent-hover);

    --btn-primary-hover: #D9D6CE;
    --band-bg: var(--ink-bg2);
    --code-bg: var(--screen);
    --inverse-bg: var(--screen);
    --inverse-line: var(--ink-line);
    --device-frame: var(--ink-line);
    --device-shadow: rgba(0, 0, 0, 0.5);
    --key-bg: var(--ink-bg2);
    --switchboard: #F0673A;
  }
}


/* 3. Base ------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--fg);
  background: var(--bg);
  overflow-wrap: break-word;
}

h1,
h2,
h3,
p,
ol,
ul,
pre {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

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

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

  a {
    transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
  }
}


/* 4. Shared pieces ---------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.mono {
  font-family: var(--font-mono);
}

/* Small mono label above a heading */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-13);
  letter-spacing: 2px;
  color: var(--muted);
}

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

.eyebrow--switchboard {
  color: var(--switchboard);
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 640px;
}

.section-head--wide {
  max-width: none;
}

.section-title {
  font-size: var(--fs-h2);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.022em;
}

/* Accent text links */
.link {
  color: var(--accent);
}

.link:hover {
  color: var(--accent-hover);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 24px;
  border-radius: 14px;
  font-size: var(--fs-17);
  text-decoration: none;
}

.btn--primary {
  background: var(--fg);
  color: var(--bg);
  font-weight: 500;
}

.btn--primary:hover {
  background: var(--btn-primary-hover);
}

.btn--secondary {
  padding-inline: 22px;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--fg);
}

.btn--secondary:hover {
  border-color: var(--muted);
}

.btn--small {
  position: relative;
  min-height: 40px;
  padding: 4px 18px;
  border-radius: 12px;
  font-size: var(--fs-15);
}

/* Keeps the 40px look but gives the button a 44px touch target. */
.btn--small::after {
  content: "";
  position: absolute;
  inset: -2px 0;
}

.logo {
  flex-shrink: 0;
}

/* Cards */
.card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.card__text {
  font-size: var(--fs-15);
  line-height: 1.5;
  color: var(--muted);
}

/* A command named in running text */
.card__text code {
  font-family: var(--font-mono);
  font-size: 0.93em;
}

/* Terminal commands. Long commands wrap rather than overflow the card. */
.code {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--code-bg);
  color: var(--screen-text);
  font-family: var(--font-mono);
  font-size: var(--fs-13);
  line-height: calc(20 / 13);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.code code {
  font: inherit;
}

/* "soon" marker for things that are not released yet */
.tag {
  display: inline-block;
  padding: 2px 6px 2px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  line-height: 1.3;
  letter-spacing: 2px;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
}


/* 5. Nav -------------------------------------------------------------------- */

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  /* 20px + a 44px row gives the artboard's 84px bar. */
  padding-block: 20px;
  font-size: var(--fs-15);
}

.nav__home {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-decoration: none;
}

.nav__sep {
  color: var(--line);
}

.nav__product {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.nav__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 22px;
  margin-left: auto;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
}

.nav__link:hover {
  color: var(--fg);
}

/* Below this width the links no longer fit beside the brand: give them their
   own row, left-aligned, with the button at the far end. */
@media (max-width: 900px) {
  .nav {
    row-gap: 4px;
    padding-block: 14px;
  }

  .nav__links {
    flex-basis: 100%;
    margin-left: 0;
  }

  .nav__links .btn {
    margin-left: auto;
  }
}


/* 6. Hero ------------------------------------------------------------------- */

.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 48px;
  padding-block: 56px 40px;
}

.hero__copy {
  flex: 1 1 420px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hero__title {
  font-size: var(--fs-h1);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.hero__lede {
  max-width: 560px;
  font-size: var(--fs-lede);
  line-height: 1.45;
  color: var(--muted);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.hero__note {
  font-size: var(--fs-13);
  color: var(--muted);
}

@media (max-width: 640px) {
  .hero {
    gap: 40px;
    padding-block: 28px 32px;
  }
}

@media (max-width: 480px) {
  .hero__actions .btn {
    flex: 1 1 100%;
    justify-content: center;
  }
}

/* Device mock-ups.
   Every dimension is a multiple of --u (1px at full size). When the art
   column is narrower than the full composition (556 units), --u shrinks so
   the phone and the browser window scale down together instead of clipping. */

.hero__art {
  flex: 1 1 460px;
  min-width: 0;
  container-type: inline-size;
}

.devices {
  --u: 1px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: calc(24 * var(--u));
}

@container (max-width: 556px) {
  .devices {
    --u: calc(100cqw / 556);
  }
}

.device {
  position: relative;
  overflow: hidden;
  background: var(--screen);
  border-style: solid;
  border-color: var(--device-frame);
  box-shadow: 0 calc(30 * var(--u)) calc(60 * var(--u)) var(--device-shadow);
  color: var(--ink-fg);
}

.device--phone {
  flex-shrink: 0;
  width: calc(232 * var(--u));
  height: calc(452 * var(--u));
  border-width: calc(6 * var(--u));
  border-radius: calc(36 * var(--u));
}

.device--browser {
  flex: 1 1 calc(270 * var(--u));
  min-width: 0;
  max-width: calc(370 * var(--u));
  height: calc(270 * var(--u));
  border-width: calc(5 * var(--u));
  border-radius: calc(14 * var(--u));
}

/* The remote desktop shown on both devices */
.desktop {
  position: absolute;
  inset-inline: 0;
  background: linear-gradient(160deg, #2B3A55 0%, #1C2230 60%);
}

.desktop__menubar {
  position: absolute;
  inset: 0 0 auto 0;
  background: rgba(240, 238, 232, 0.9);
}

.desktop__window {
  position: absolute;
  border-radius: calc(6 * var(--u));
}

.desktop__window--back {
  background: #262626;
}

.desktop__window--front {
  background: #333331;
}

/* Phone */
.phone__status {
  position: absolute;
  inset: 0 0 auto 0;
  height: calc(52 * var(--u));
  display: flex;
  align-items: center;
  gap: calc(8 * var(--u));
  padding: calc(18 * var(--u)) calc(12 * var(--u)) 0;
}

.phone__dot {
  width: calc(7 * var(--u));
  height: calc(7 * var(--u));
  border-radius: 50%;
  background: var(--ink-accent);
  box-shadow: 0 0 0 calc(3 * var(--u)) rgba(76, 195, 224, 0.18);
}

.phone__name {
  font-size: calc(11 * var(--u));
  font-weight: 500;
}

.phone__latency {
  font-size: calc(9 * var(--u));
  color: var(--ink-muted);
}

.device--phone .desktop {
  top: calc(52 * var(--u));
  bottom: calc(56 * var(--u));
}

.device--phone .desktop__menubar {
  height: calc(8 * var(--u));
}

.device--phone .desktop__window--back {
  left: calc(14 * var(--u));
  top: calc(26 * var(--u));
  width: calc(150 * var(--u));
  height: calc(110 * var(--u));
}

.device--phone .desktop__window--front {
  left: calc(60 * var(--u));
  top: calc(70 * var(--u));
  width: calc(140 * var(--u));
  height: calc(100 * var(--u));
}

.phone__toolbar {
  position: absolute;
  inset: auto 0 0 0;
  height: calc(57 * var(--u));
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-inline: calc(6 * var(--u));
  background: var(--ink-bg2);
  border-top: 1px solid var(--ink-line);
  font-size: calc(8 * var(--u));
  color: var(--screen-text);
}

.phone__toolbar .is-active {
  color: var(--ink-accent);
}

/* Browser window */
.browser__bar {
  position: absolute;
  inset: 0 0 auto 0;
  height: calc(22 * var(--u));
  display: flex;
  align-items: center;
  gap: calc(8 * var(--u));
  padding-inline: calc(10 * var(--u));
  background: var(--ink-bg);
}

.browser__dot {
  width: calc(6 * var(--u));
  height: calc(6 * var(--u));
  border-radius: 50%;
  background: #2F6FD6;
}

.browser__name {
  font-size: calc(9 * var(--u));
}

.browser__live {
  margin-left: auto;
  font-size: calc(8 * var(--u));
  color: var(--ink-accent);
}

.device--browser .desktop {
  top: calc(22 * var(--u));
  bottom: 0;
}

.device--browser .desktop__menubar {
  height: calc(7 * var(--u));
}

.device--browser .desktop__window--back {
  left: calc(30 * var(--u));
  top: calc(24 * var(--u));
  width: calc(190 * var(--u));
  height: calc(130 * var(--u));
}

.device--browser .desktop__window--front {
  left: calc(130 * var(--u));
  top: calc(60 * var(--u));
  width: calc(180 * var(--u));
  height: calc(120 * var(--u));
}


/* 7. How it works ----------------------------------------------------------- */

.how {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-block: 48px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
}

.step {
  gap: 12px;
  padding: 24px;
}

.step__number {
  font-size: var(--fs-13);
  color: var(--accent);
}

.step__title {
  font-size: var(--fs-20);
  font-weight: 700;
}


/* 8. What it does ----------------------------------------------------------- */

/* A dark band in both themes: remap the tokens to the ink palette so
   everything inside (text, borders, focus rings) follows. */
.features {
  --fg: var(--ink-fg);
  --muted: var(--ink-muted);
  --line: var(--ink-line);
  --accent: var(--ink-accent);
  --accent-hover: var(--ink-accent-hover);

  background: var(--band-bg);
  color: var(--fg);
}

.features__inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding-block: 64px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}

.feature {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.feature__title {
  font-size: var(--fs-18);
  font-weight: 700;
}


/* 9. Also from Evil Teddy --------------------------------------------------- */

.also {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
  padding-block: 56px;
}

.also__copy {
  flex: 1 1 380px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.also__title {
  font-size: var(--fs-h2-small);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.also__text {
  font-size: var(--fs-16);
  line-height: 1.5;
  color: var(--muted);
}

.also__link {
  align-self: flex-start;
  /* Padding and an equal negative margin: a 44px touch target with no
     change to the spacing. */
  padding-block: 12px;
  margin-block: -12px;
  font-size: var(--fs-16);
  font-weight: 500;
}

/* Creator Micro keypad */
.keypad {
  flex: 1 1 320px;
  max-width: 420px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.key {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--key-bg);
}

.key__ring {
  width: 28px;
  height: 28px;
  border: 3px solid var(--ink-line);
  border-radius: 11px;
}

.key__lit {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #F0673A;
  box-shadow: 0 0 0 7px rgba(240, 103, 58, 0.18);
}

.key__porthole {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--ink-accent);
  border-radius: 15px;
}

.key__porthole::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink-accent);
}


/* 10. Install --------------------------------------------------------------- */

.install {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-block: 24px 72px;
}

.install-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 16px;
}

.install-card {
  gap: 10px;
  padding: 22px;
}

.install-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.install-card__title {
  font-size: var(--fs-18);
  font-weight: 700;
}

.install-card__note {
  font-size: var(--fs-14);
  color: var(--muted);
}

/* "Then look in from": dark in both themes, so remap to the ink palette. */
.install-card--inverse {
  --fg: var(--ink-fg);
  --muted: var(--ink-muted);
  --line: var(--ink-line);
  --accent: var(--ink-accent);
  --accent-hover: var(--ink-accent-hover);

  background: var(--inverse-bg);
  border-color: var(--inverse-line);
  color: var(--fg);
}

.clients {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: var(--fs-15);
}

.clients__link {
  display: inline-block;
  /* 44px touch target without changing the row spacing. */
  padding-block: 13px;
  margin-block: -13px;
}

/* Not available yet: plain text, muted, with a "soon" tag. */
.clients__soon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  color: var(--muted);
}


/* 11. Footer ---------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 28px;
  /* 11px + a 44px row gives the artboard's footer height. */
  padding-block: 11px;
  font-size: var(--fs-14);
  color: var(--muted);
}

.site-footer__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}

.site-footer__link:hover {
  color: var(--fg);
}

.site-footer__version {
  margin-left: auto;
  font-size: var(--fs-12);
}

@media (max-width: 640px) {
  .site-footer__version {
    flex-basis: 100%;
    margin-left: 0;
    padding-block: 10px;
  }
}
