/* =========================================================================
   promethic.co.za
   Plain CSS, mobile-first, no build step.
   Brand: wordmark "promethic", Space Grotesk 600 + Inter, dark-first.
   ========================================================================= */

/* ---------- Fonts: self-hosted, SIL Open Font Licence (see /fonts) ---------- */

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

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

/* Stand-ins sized to match, so text barely moves when the real fonts arrive */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial"), local("Helvetica"), local("Liberation Sans");
  size-adjust: 107.35%;
  ascent-override: 90.24%;
  descent-override: 22.47%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Space Grotesk Fallback";
  src: local("Arial"), local("Helvetica"), local("Liberation Sans");
  size-adjust: 110.86%;
  ascent-override: 88.76%;
  descent-override: 26.34%;
  line-gap-override: 0%;
}

/* ---------- Tokens ---------- */

:root {
  /* Brand colours */
  --obsidian: #0d0d10;
  --graphite: #17171b;
  --smoke: #8c8a85;
  --ash: #f4f1ec;
  --ember: #ff5b1f;
  --forge: #c2410c;
  --gold: #f2b544;   /* Seymour, education */
  --sky: #8fb8ff;    /* Konstantin, aerospace */

  /* Derived */
  --orbit: #222228;  /* the orbit line, as on the Play Store header */
  --line: #26262c;   /* hairlines */
  --raised: #1f1f24; /* hover on graphite */

  --font-display: "Space Grotesk", "Space Grotesk Fallback", system-ui, sans-serif;
  --font-body: "Inter", "Inter Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Type scale */
  --text-sm: 0.875rem;
  --text-base: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);
  --text-lead: clamp(1.125rem, 1.03rem + 0.45vw, 1.3125rem);
  --text-h3: 1.3125rem;
  --text-h2: clamp(1.75rem, 1.4rem + 1.6vw, 2.25rem);

  /* Space */
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --section-space: clamp(5rem, 3.5rem + 7vw, 9rem);
  --wrap: 70rem;

  /* Width of the hero wordmark. The orbit and the hero height scale from it. */
  --wm: max(12rem, min(72vw, 54rem, calc(100vh - 9rem)));
}

@supports (height: 100svh) {
  :root {
    --wm: max(12rem, min(72vw, 54rem, calc(100svh - 9rem)));
  }
}

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

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

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

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

body {
  margin: 0;
  background: var(--obsidian);
  color: var(--ash);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

ul,
ol {
  padding: 0;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

[hidden] {
  display: none !important;
}

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

a:hover {
  color: var(--ember);
}

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

::selection {
  background: var(--ember);
  color: var(--obsidian);
}

/* ---------- Helpers ---------- */

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

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  z-index: 10;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: var(--ash);
  color: var(--obsidian);
  font-family: var(--font-display);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
}

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

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

/* ---------- Header ---------- */

.site-header {
  position: relative;
  z-index: 1;
}

.nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  column-gap: clamp(1rem, 4vw, 2.25rem);
  padding-block: 0.5rem;
  list-style: none;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--smoke);
  font-size: 0.9375rem;
  text-decoration: none;
}

.nav a:hover {
  color: var(--ash);
}

/* ---------- Home ---------- */

.hero {
  --hero-top: clamp(1.5rem, 5vw, 3.5rem);
  position: relative;
  overflow: hidden;
  overflow: clip;
  min-height: calc(var(--hero-top) + var(--wm) * 1.02);
  padding: var(--hero-top) var(--gutter) 2.5rem;
  text-align: center;
}

.hero-mark {
  width: var(--wm);
  height: auto;
  aspect-ratio: 922 / 438;
  margin-inline: auto;
  overflow: visible;
}

.hero-line {
  max-width: 34em;
  margin: clamp(1rem, 3vw, 2rem) auto 0;
  color: var(--smoke);
  font-size: var(--text-lead);
  line-height: 1.5;
  text-wrap: balance;
}

/* Wordmark pieces (also used by the footer) */
.wordmark-letters {
  fill: var(--ash);
}

.spark,
.spark-static {
  fill: var(--ember);
}

.orbit {
  fill: none;
  stroke: var(--orbit);
  stroke-width: 32;
  stroke-linecap: round;
}

.spark-glow {
  fill: var(--ember);
  opacity: 0;
}

/* The group's origin is the centre of the orbit, so rotating it moves the
   spark along the ring: it leaves the ring's tip and lands on the i. */
.spark-path {
  transform-box: view-box;
  transform-origin: 0 0;
}

@media (prefers-reduced-motion: no-preference) {
  .spark-path {
    animation: spark-travel 1.4s cubic-bezier(0.55, 0, 0.2, 1) 0.4s backwards;
  }

  .spark {
    animation: spark-light 1.4s linear 0.4s backwards;
  }

  .spark-glow {
    animation: spark-bloom 1.2s ease-out 1.75s backwards;
  }
}

@keyframes spark-travel {
  from {
    transform: rotate(-45deg);
  }
}

@keyframes spark-light {
  from {
    opacity: 0;
  }

  25% {
    opacity: 1;
  }
}

@keyframes spark-bloom {
  0% {
    opacity: 0;
  }

  25% {
    opacity: 0.55;
  }

  100% {
    opacity: 0;
  }
}

/* ---------- Sections ---------- */

.section {
  padding-top: var(--section-space);
  scroll-margin-top: 0.5rem;
}

/* The hero already ends in open space */
.hero + .section {
  padding-top: clamp(1.5rem, 4vw, 3rem);
}

.section-head {
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-h2);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.section-intro {
  max-width: 46ch;
  margin-top: 0.75rem;
  color: var(--smoke);
}

/* ---------- App icons (shared) ---------- */

/* Until an icon file exists, the initials in data-initials show instead. */
.icon {
  position: relative;
  display: block;
  flex: none;
  width: 4.5rem;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 22%;
  background: var(--graphite);
  box-shadow: inset 0 0 0 1px var(--line);
}

.icon::before {
  content: attr(data-initials);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--smoke);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.icon img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  color: transparent; /* hides alt text if an image is missing and JS is off */
}

/* ---------- Apps ---------- */

.app-list {
  display: grid;
  gap: 2.5rem;
  list-style: none;
}

.app {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 1.25rem;
  align-items: start;
}

.app-name {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.app-text {
  max-width: 36ch;
  margin-top: 0.375rem;
  color: var(--smoke);
}

.app-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: var(--text-sm);
  text-decoration-color: var(--ember);
}

/* The whole app is the tap target */
.app-link::after {
  content: "";
  position: absolute;
  inset: -0.75rem;
  border-radius: 1.25rem;
}

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

.app-link:focus-visible {
  outline: none;
}

.app-link:focus-visible::after {
  outline: 2px solid var(--ember);
}

/* The Grade 12 series: one family, one shelf */
.series {
  margin-top: clamp(3.5rem, 8vw, 5rem);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: 1.5rem;
  background: var(--graphite);
}

.series-title {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.series-text {
  max-width: 44ch;
  margin-top: 0.375rem;
  color: var(--smoke);
}

/* Three across on phones, four on small tablets, all seven in a row on wide
   screens. A short last row is centred. */
.tiles {
  --cols: 3;
  --gap: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gap);
  margin-top: 1.5rem;
  list-style: none;
}

.tiles > li {
  flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  height: 100%;
  padding: 1rem 0.25rem 0.875rem;
  border-radius: 1rem;
  color: var(--ash);
  font-size: var(--text-sm);
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}

.tile:hover {
  background: var(--raised);
  color: var(--ash);
}

.tile .icon {
  width: 4rem;
  background: var(--obsidian);
}

/* ---------- Client work ---------- */

.cases {
  display: grid;
  gap: clamp(3.5rem, 8vw, 4.5rem);
}

.case {
  position: relative;
}

/* Until a screenshot exists, the client's name shows in the frame. */
.shot {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border-radius: 0.75rem;
  background: var(--graphite);
}

.shot img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  color: transparent;
}

/* Phone screenshot instead? Add "shot--phone" to the frame's class. */
.shot--phone img {
  padding-block: clamp(1rem, 3vw, 1.75rem);
  object-fit: contain;
}

/* Hairline drawn over the screenshot, so dark sites keep their edge */
.shot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--line);
  pointer-events: none;
}

.shot-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  color: var(--smoke);
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1rem + 1.5vw, 1.75rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-align: center;
  text-wrap: balance;
}

.case-body {
  margin-top: 1.5rem;
}

.case-name {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.case-meta {
  margin-top: 0.25rem;
  color: var(--smoke);
  font-size: var(--text-sm);
}

.case-text {
  max-width: 46ch;
  margin-top: 0.875rem;
}

.case-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: var(--text-sm);
  text-decoration-color: var(--ember);
}

.case-link::after {
  content: "";
  position: absolute;
  inset: -0.75rem;
  border-radius: 1.25rem;
}

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

.case-link:focus-visible {
  outline: none;
}

.case-link:focus-visible::after {
  outline: 2px solid var(--ember);
}

.case-status {
  margin-top: 1rem;
  color: var(--smoke);
  font-size: var(--text-sm);
}

/* ---------- About ---------- */

.about-body {
  display: grid;
  gap: 1.25rem;
  max-width: 58ch;
  margin-top: clamp(1.5rem, 4vw, 2.25rem);
  font-size: var(--text-lead);
  line-height: 1.55;
}

/* Now, next, horizon: a trajectory, so the dots sit on one line.
   Vertical on phones, horizontal on wider screens. */
.horizons {
  position: relative;
  display: grid;
  gap: 2rem;
  margin-top: clamp(3rem, 7vw, 4.5rem);
  padding-left: 2rem;
  list-style: none;
}

.horizons::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  bottom: 0.5rem;
  left: 5px;
  width: 1px;
  background: var(--line);
}

.horizon {
  --dot: var(--smoke);
  position: relative;
}

.horizon::before {
  content: "";
  position: absolute;
  top: 0.45rem;
  left: -2rem;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--dot);
}

.horizon-now {
  --dot: var(--gold);
}

.horizon-next {
  --dot: var(--ember);
}

.horizon-far {
  --dot: var(--sky);
}

.horizon-when {
  display: block;
  color: var(--smoke);
  font-size: var(--text-sm);
}

.horizon-what {
  display: block;
  margin-top: 0.125rem;
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.horizon-text {
  display: block;
  max-width: 30ch;
  margin-top: 0.5rem;
  color: var(--smoke);
}

/* ---------- Contact ---------- */

.contact-email {
  display: inline-block;
  margin-top: clamp(1.5rem, 4vw, 2.5rem);
  font-family: var(--font-display);
  /* Fills a phone screen without wrapping; caps at 60px */
  font-size: clamp(1.25rem, (100vw - 2 * var(--gutter)) / 12.6, 3.75rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-decoration-color: var(--ember);
  text-decoration-thickness: 0.05em;
  /* Sits below the descenders, so the ember line runs unbroken */
  text-underline-offset: 0.32em;
  text-decoration-skip-ink: none;
}

.copy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--graphite);
  color: var(--ash);
  font: 600 0.9375rem/1 var(--font-display);
  cursor: pointer;
}

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

.copy-status {
  color: var(--smoke);
  font-size: var(--text-sm);
}

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

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

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-block: 1.75rem 2.25rem;
  color: var(--smoke);
  font-size: var(--text-sm);
}

/* Wordmark with the tagline beside it, as on the Play Store header */
.footer-brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1rem;
}

.footer-tagline {
  color: var(--gold);
  font-family: var(--font-display);
  font-weight: 600;
}

.footer-home {
  display: block;
  padding-block: 0.5rem;
}

.footer-mark {
  width: 6.5rem;
  height: auto;
  aspect-ratio: 922 / 185;
}

/* ---------- Not found page ---------- */

.notfound {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 1.25rem;
  min-height: 70vh;
  min-height: 70svh;
  padding-block: 4rem;
}

.notfound .footer-mark {
  width: 9rem;
}

.notfound p {
  max-width: 40ch;
  color: var(--smoke);
}

.notfound p a {
  color: var(--ash);
  text-decoration-color: var(--ember);
}

.notfound p a:hover {
  color: var(--ember);
}

/* ---------- Larger screens ---------- */

@media (min-width: 30rem) {
  .tiles {
    --cols: 4;
  }
}

@media (min-width: 52rem) {
  .app-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 2.5rem;
  }

  .app {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 1.25rem;
  }

  .tiles {
    --cols: 7;
  }

  .cases {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(2rem, 4vw, 3.5rem);
  }

  .horizons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2.5rem;
    padding-top: 2rem;
    padding-left: 0;
  }

  .horizons::before {
    top: 5px;
    right: 0;
    bottom: auto;
    left: 0;
    width: auto;
    height: 1px;
    background: linear-gradient(to right, var(--line) 75%, transparent);
  }

  .horizon::before {
    top: -2rem;
    left: 0;
  }
}

/* ---------- High contrast (Windows) ---------- */

@media (forced-colors: active) {
  .wordmark-letters {
    fill: CanvasText;
  }

  .orbit {
    stroke: GrayText;
  }

  .spark,
  .spark-static {
    fill: Highlight;
  }

  .icon,
  .shot,
  .series {
    border: 1px solid CanvasText;
  }
}
