/* ==========================================================================
   Experimental project layouts — shared foundation
   A small, deliberate set of tokens and primitives so every study reads as
   part of the same academic system: graphite ground, Cormorant display type,
   Flex for apparatus, brass for emphasis, hairline rules everywhere.
   Each study supplies only its own layout in a page-level <style> block.
   ========================================================================== */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("../assets/fonts/CormorantGaramond-VariableFont_wght.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cormorant Garamond";
  src: url("../assets/fonts/CormorantGaramond-Italic-VariableFont_wght.woff2") format("woff2");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Flex";
  src: url("../img/fonts/roboto-flex.ttf") format("truetype");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* ground */
  --bg: #1b1a17;
  --bg-2: #201f1b;
  --bg-3: #232220;
  --bg-deep: #14130f;

  /* ink */
  --fg: #e9e3d6;
  --muted: #a39c8b;
  --faint: #6d675b;

  /* structure */
  --line: #37352f;
  --rule: #292723;

  /* accent */
  --brass: #c8a765;
  --brass-dim: #7f6a41;
  --brass-soft: rgba(200, 167, 101, 0.12);
  --rubric: #b06a4e;
  --ink: #131210;

  /* type */
  --serif: "Cormorant Garamond", Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: Flex, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* measure */
  --pad: clamp(20px, 4.6vw, 64px);
  --measure: 66ch;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 40px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

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

p {
  margin: 0 0 1.15em;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 400;
  line-height: 1.12;
}

ul,
ol,
dl,
dd {
  margin: 0;
  padding: 0;
}

ul,
ol {
  list-style: none;
}

::selection {
  background: var(--brass);
  color: var(--ink);
}

:focus-visible {
  outline: 1px solid var(--brass);
  outline-offset: 5px;
}

/* ---- utility ----------------------------------------------------------- */

.serif { font-family: var(--serif); }
.mono { font-family: var(--mono); }
.em { color: var(--brass); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

.meta {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.kicker {
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brass);
}

.hairline {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: fixed;
  top: -70px;
  left: 16px;
  z-index: 200;
  padding: 9px 14px;
  background: var(--brass);
  color: var(--ink);
  font: 10px/1 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.skip:focus {
  top: 12px;
  color: var(--ink);
}

/* ---- links ------------------------------------------------------------- */

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.links a {
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
}

.links a:hover {
  color: var(--brass);
  border-color: var(--brass-dim);
}

.links .arrow {
  color: var(--brass);
  margin-left: 4px;
}

/* ---- plate ------------------------------------------------------------- */

.plate {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: var(--bg-3);
  border: 1px solid var(--line);
}

.plate img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  filter: grayscale(0.18) saturate(0.66) brightness(0.9) contrast(1.025) sepia(0.06);
  transition: filter 0.65s ease, transform 1.1s ease;
}

.plate:hover img,
a:hover > .plate img,
a:hover .plate img {
  filter: grayscale(0) saturate(0.92) brightness(1) contrast(1.02) sepia(0);
  transform: scale(1.012);
}

/* A typographic cover for projects without a supplied screenshot.
   Kept deliberately quiet: a record for Luno, a handset for Luno Mobile. */

.text-plate {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  height: 100%;
  min-height: 220px;
  padding: clamp(18px, 5%, 42px);
  overflow: hidden;
  background:
    radial-gradient(130% 130% at 74% 14%, #2c2923 0%, #211f1b 48%, #191815 100%);
}

.text-plate::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, rgba(233, 227, 214, 0.035) 0%, transparent 38%);
}

.tp-kicker {
  position: relative;
  z-index: 1;
  font: 500 9px/1 var(--sans);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 12px;
}

.tp-title {
  position: relative;
  z-index: 1;
  font: 400 clamp(30px, 3.8vw, 56px)/0.98 var(--serif);
  letter-spacing: -0.015em;
  color: var(--fg);
}

.tp-note {
  position: relative;
  z-index: 1;
  margin-top: 9px;
  font: italic 15px/1.4 var(--serif);
  color: var(--muted);
}

.tp-disc {
  position: absolute;
  top: 10%;
  right: 9%;
  width: 38%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid #4a4335;
  background:
    repeating-radial-gradient(circle at center, #211f1b 0 4px, rgba(200, 167, 101, 0.1) 4px 5px);
  box-shadow: 0 0 0 10px rgba(0, 0, 0, 0.1);
}

.tp-disc::after {
  content: "";
  position: absolute;
  inset: 43%;
  border-radius: 50%;
  background: var(--brass);
  opacity: 0.75;
}

.tp-phone {
  position: absolute;
  top: 10%;
  right: 12%;
  width: 26%;
  height: 54%;
  border: 1px solid #4a4335;
  border-radius: 10px;
  background: linear-gradient(160deg, #25231e, #1b1a16);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
}

.tp-phone::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 34%;
  height: 2px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: #4a4335;
}

.tp-wave {
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 18%;
  display: flex;
  align-items: flex-end;
  gap: 8%;
  height: 24%;
}

.tp-wave i {
  flex: 1;
  background: var(--brass);
  opacity: 0.7;
}

.tp-wave i:nth-child(1) { height: 38%; }
.tp-wave i:nth-child(2) { height: 72%; }
.tp-wave i:nth-child(3) { height: 100%; }
.tp-wave i:nth-child(4) { height: 58%; }
.tp-wave i:nth-child(5) { height: 28%; }

/* ---- study mark -------------------------------------------------------- */

.study-mark {
  position: fixed;
  right: 0;
  top: 50%;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 8px;
  max-height: 70vh;
  padding: 11px 7px;
  border: 1px solid var(--line);
  border-right: 0;
  background: rgba(27, 26, 23, 0.88);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font: 8px/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  writing-mode: vertical-rl;
  transform: translateY(-50%) rotate(180deg);
}

.study-mark b {
  font-weight: 500;
  color: var(--brass);
}

.study-mark a {
  color: var(--muted);
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}

.study-mark a:hover {
  color: var(--fg);
  border-color: var(--line);
}

.study-mark .sep {
  color: var(--line);
}

@media (max-width: 700px) {
  .study-mark {
    right: 10px;
    top: auto;
    bottom: 10px;
    gap: 0;
    max-height: none;
    padding: 6px 8px;
    border-right: 1px solid var(--line);
    font-size: 7px;
    writing-mode: horizontal-tb;
    transform: none;
  }

  .study-mark b,
  .study-mark .sep,
  .study-mark .long {
    display: none;
  }
}

/* On narrow screens the middle line of a running head is the first thing
   that can go; the identity and the date carry enough context. */
@media (max-width: 560px) {
  .topline > :nth-child(2),
  .topbar > :nth-child(2) {
    display: none;
  }
}

/* ---- motion ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .study-mark,
  .skip {
    display: none;
  }

  body {
    background: #fff;
    color: #111;
  }
}
