/* ============================================================
   DipOS — design system for dipsportfolio.me
   Retro desktop-OS aesthetic: hard borders, offset shadows,
   striped title bars, cream paper, signature orange.
   ============================================================ */

:root {
  --cream:  #FFFCF2;
  --paper:  #FFFEFA;
  --ink:    #1C1B18;
  --orange: #FE6420;
  --blue:   #4C89C8;
  --butter: #FFE3A9;
  --pink:   #FFCFD8;
  --mint:   #CFE9D2;
  --lav:    #DCCBFF;
  --dot:    rgba(28, 27, 24, 0.13);

  --font-ui:    "Inter Tight", "Helvetica Neue", sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono:  "IBM Plex Mono", "Courier New", monospace;

  --menubar-h: 46px;
  --ticker-h: 40px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--cream);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.4px);
  background-size: 24px 24px;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--orange); color: var(--cream); }

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

a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
p a, li a, figcaption a { color: var(--blue); font-weight: 600; }
p a:hover, li a:hover { background: var(--butter); }

/* ------------------------------------------------------------
   Menu bar
   ------------------------------------------------------------ */
.menubar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--menubar-h);
  z-index: 900;
  display: flex;
  align-items: stretch;
  gap: 2px;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 0 10px;
}

.menubar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  text-decoration: none;
  padding: 0 10px;
  letter-spacing: 0.02em;
}
.menubar .brand .dot {
  width: 13px; height: 13px;
  background: var(--orange);
  border: 2px solid var(--ink);
  border-radius: 50%;
  flex: none;
}

.menubar nav { display: flex; align-items: stretch; }

.menubar nav > a,
.menubar details > summary {
  display: flex;
  align-items: center;
  padding: 0 12px;
  text-decoration: none;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.menubar details > summary::-webkit-details-marker { display: none; }
.menubar nav > a:hover, .menubar nav > a:focus-visible,
.menubar details > summary:hover, .menubar details[open] > summary {
  background: var(--ink);
  color: var(--cream);
}
.menubar nav > a[aria-current="page"] { background: var(--orange); color: var(--ink); }

.menubar details { position: relative; }
.menubar .menu-list {
  position: absolute;
  top: calc(var(--menubar-h) - 2px);
  left: 0;
  min-width: 230px;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  display: flex;
  flex-direction: column;
  z-index: 950;
}
.menubar .menu-list a {
  padding: 11px 14px;
  text-decoration: none;
  border-bottom: 1.5px solid var(--ink);
  display: flex;
  justify-content: space-between;
  gap: 14px;
}
.menubar .menu-list a:last-child { border-bottom: none; }
.menubar .menu-list a:hover, .menubar .menu-list a:focus-visible { background: var(--butter); }
.menubar .menu-list a span { opacity: 0.55; font-size: 11px; }

.menubar .clock {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 6px;
  z-index: 1000;
  background: var(--orange);
  color: var(--ink);
  padding: 8px 14px;
  border: 2px solid var(--ink);
  font-family: var(--font-mono);
}
.skip-link:focus { left: 8px; }

/* ------------------------------------------------------------
   Desktop (homepage)
   ------------------------------------------------------------ */
.desktop {
  position: relative;
  min-height: 100dvh;
  padding: calc(var(--menubar-h) + 18px) 18px calc(var(--ticker-h) + 18px);
  overflow: hidden;
}

/* Desktop icons */
.icon {
  position: absolute;
  width: 104px;
  display: grid;
  justify-items: center;
  gap: 7px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-mono);
  text-decoration: none;
  color: var(--ink);
  z-index: 10;
}
.icon svg { width: 58px; height: 58px; }
.icon .icon-label {
  font-size: 11.5px;
  line-height: 1.3;
  text-align: center;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  padding: 2px 7px;
}
.icon:hover .icon-label, .icon:focus-visible .icon-label {
  background: var(--ink);
  color: var(--cream);
}
.icon:focus-visible { outline: 3px solid var(--orange); outline-offset: 4px; }
.icon:active svg { transform: translate(1px, 1px); }

/* ------------------------------------------------------------
   Windows
   ------------------------------------------------------------ */
.window {
  position: absolute;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 7px 7px 0 var(--ink);
  width: min(460px, calc(100vw - 40px));
  z-index: 20;
}
.window[hidden] { display: none; }

.window.is-opening { animation: win-pop 0.18s ease-out; }
@keyframes win-pop {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);     opacity: 1; }
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-bottom: 2px solid var(--ink);
  cursor: grab;
  touch-action: none;
  background-color: var(--butter);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 3px,
    rgba(28, 27, 24, 0.16) 3px 4.5px
  );
}
.titlebar:active { cursor: grabbing; }
.window--orange .titlebar, .titlebar.window--orange { background-color: var(--orange); }
.window--pink   .titlebar, .titlebar.window--pink   { background-color: var(--pink); }
.window--mint   .titlebar, .titlebar.window--mint   { background-color: var(--mint); }
.window--blue   .titlebar, .titlebar.window--blue   { background-color: var(--blue); }
.window--lav    .titlebar, .titlebar.window--lav    { background-color: var(--lav); }

.titlebar .title {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  padding: 1px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.winbtn {
  width: 18px; height: 18px;
  flex: none;
  background: var(--paper);
  border: 2px solid var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  padding: 0;
  color: var(--ink);
  text-decoration: none;
}
.winbtn:hover, .winbtn:focus-visible { background: var(--orange); }
.winbtn.spacer { visibility: hidden; }

.winbody { padding: 26px 28px; }
.winbody > * + * { margin-top: 14px; }

/* ------------------------------------------------------------
   Typography pieces
   ------------------------------------------------------------ */
.display {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(36px, 6vw, 58px);
  line-height: 0.98;
  letter-spacing: -0.01em;
}
.display em { color: var(--orange); font-style: italic; }

.kicker {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kicker::before {
  content: "";
  width: 9px; height: 9px;
  background: var(--orange);
  border: 1.5px solid var(--ink);
  flex: none;
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border: 1.5px solid var(--ink);
  background: var(--butter);
  padding: 3px 9px;
}
.chip--blue { background: var(--blue); color: var(--cream); }
.chip--pink { background: var(--pink); }
.chip--mint { background: var(--mint); }

.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  background: var(--orange);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 11px 18px;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:hover, .btn:focus-visible { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: none; }
.btn--ghost { background: var(--paper); }
.btn--blue  { background: var(--blue); color: var(--cream); }
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; }

/* ------------------------------------------------------------
   Ticker (multilingual welcome marquee)
   ------------------------------------------------------------ */
.ticker {
  position: fixed;
  inset: auto 0 0 0;
  height: var(--ticker-h);
  z-index: 900;
  background: var(--orange);
  border-top: 2px solid var(--ink);
  overflow: hidden;
  display: flex;
  align-items: center;
}
.ticker .reel {
  display: flex;
  flex: none;
  gap: 0;
  animation: ticker-scroll 30s linear infinite;
}
.ticker span {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  white-space: nowrap;
  padding-right: 3em;
  color: var(--cream);
}
.ticker span b { color: var(--ink); font-weight: 600; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .ticker { overflow-x: auto; }
}

/* ------------------------------------------------------------
   Case study pages — the "document"
   ------------------------------------------------------------ */
.doc-wrap {
  padding: calc(var(--menubar-h) + 42px) 18px 80px;
  max-width: 980px;
  margin: 0 auto;
}

.doc {
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 9px 9px 0 var(--ink);
}
.doc > .titlebar { cursor: default; }
.doc-body { padding: clamp(26px, 5.5vw, 68px); }

.doc-hero { margin: 0 0 30px; }
.doc-hero img { border: 2px solid var(--ink); width: 100%; }

.doc h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(44px, 7vw, 76px);
  line-height: 0.95;
  margin-bottom: 16px;
}
.doc .meta { margin-bottom: 36px; }

.doc section { margin-top: 58px; }
.doc section > * + * { margin-top: 18px; }

.doc h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(30px, 4.5vw, 42px);
  line-height: 1.05;
}
.doc h3 {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(22px, 3.4vw, 28px);
}
.doc p, .doc li { max-width: 68ch; }
.doc ul { padding-left: 1.2em; }
.doc li + li { margin-top: 8px; }

.lede { font-size: 19.5px; font-weight: 500; }

.pull {
  background: var(--butter);
  border: 2px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  padding: clamp(22px, 4vw, 38px);
  font-family: var(--font-serif);
  font-size: clamp(22px, 3.6vw, 30px);
  line-height: 1.25;
  margin: 34px 0;
}
.pull--orange { background: var(--orange); color: var(--ink); }
.pull--mint   { background: var(--mint); }
.pull--pink   { background: var(--pink); }
.pull small {
  display: block;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 20px;
  margin: 34px 0;
}
.stat {
  border: 2px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  background: var(--paper);
  padding: 22px;
}
.stat b {
  display: block;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(40px, 5vw, 56px);
  line-height: 1;
  color: var(--orange);
  margin-bottom: 10px;
}
.stat p { font-size: 14.5px; line-height: 1.5; }

figure { margin: 34px 0; }
figure img, figure video {
  border: 2px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  background: #fff;
}
figcaption {
  margin-top: 13px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  opacity: 0.75;
  max-width: 60ch;
}

.figgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 26px;
  align-items: start;
  margin: 34px 0;
}
.figgrid figure { margin: 0; }
.figgrid--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) {
  .figgrid, .figgrid--3 { grid-template-columns: 1fr; }
}

/* prev / next footer nav */
.doc-nav {
  margin-top: 70px;
  padding-top: 30px;
  border-top: 2px solid var(--ink);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

/* page footer */
.site-footer {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 18px 60px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.site-footer .heart { color: var(--orange); }
.site-footer a { text-decoration-color: var(--orange); }

/* ------------------------------------------------------------
   Mobile: the desktop metaphor gracefully becomes a stacked feed
   ------------------------------------------------------------ */
@media (max-width: 780px) {
  .desktop {
    overflow: visible;
    padding-bottom: calc(var(--ticker-h) + 26px);
    display: flex;
    flex-direction: column;
    gap: 26px;
  }
  .icon { display: none; }
  .window, .window[hidden] {
    display: block;
    position: static;
    width: 100%;
    box-shadow: 5px 5px 0 var(--ink);
  }
  .window .winbtn.close { display: none; }
  .titlebar { cursor: default; touch-action: auto; }
  .menubar { font-size: 12px; padding: 0 4px; }
  .menubar .clock .date { display: none; }
  .winbody { padding: 22px 20px; }
}

@media (min-width: 781px) {
  .window .open-on-desktop[hidden] { display: none; }
}
