/* ronilcajan.com — hand-written stylesheet */

:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --ink: #171717;
  --muted: #6b6b6b;
  --line: #e7e7e7;
  --line-strong: #d4d4d4;
  --accent: #f53003;
  --accent-soft: #fff1ec;
  --accent-ink: #ffffff;
  --code-bg: #171717;
  --code-ink: #e5e5e5;

  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --wrap: 1200px;
  --gutter: clamp(16px, 3vw, 40px);
  --pad: clamp(20px, 4vw, 56px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a;
    --bg-soft: #111111;
    --ink: #ededed;
    --muted: #9a9a9a;
    --line: #232323;
    --line-strong: #333333;
    --accent: #ff4a1c;
    --accent-soft: #1f0e08;
    --accent-ink: #ffffff;
    --code-bg: #161616;
    --code-ink: #e5e5e5;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-soft: #111111;
  --ink: #ededed;
  --muted: #9a9a9a;
  --line: #232323;
  --line-strong: #333333;
  --accent: #ff4a1c;
  --accent-soft: #1f0e08;
  --accent-ink: #ffffff;
  --code-bg: #161616;
  --code-ink: #e5e5e5;
  color-scheme: dark;
}

/* ---------- base ---------- */

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a, button { touch-action: manipulation; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--accent); color: var(--accent-ink); }

h1, h2, h3, h4 { font-weight: 400; margin: 0; }
p { margin: 0; }

.mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0; }
.muted { color: var(--muted); }

.skip {
  position: absolute; left: 12px; top: 12px; z-index: 100; transform: translateY(-200%);
  background: var(--ink); color: var(--bg); padding: 13px 14px;
}
.skip:focus { transform: none; }

/* ---------- the frame: full-width bands, bordered column, corner marks ---------- */

.band { padding: 0 var(--gutter); border-bottom: 1px solid var(--line); }

.wrap {
  position: relative;
  max-width: var(--wrap); margin: 0 auto;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}

.cell { padding: var(--pad); }

.mark::before, .mark::after {
  content: ""; position: absolute; top: -4px; z-index: 2;
  width: 7px; height: 7px; background: var(--accent);
}
.mark::before { left: -4px; }
.mark::after { right: -4px; }

.eyebrow {
  display: inline-block;
  font: 500 13px/1 var(--mono); text-transform: uppercase; letter-spacing: .02em;
  color: var(--accent);
}

.title {
  font-size: clamp(34px, 4.6vw, 56px); line-height: 1.04;
  letter-spacing: -0.045em;
}

.section-head { text-align: center; padding: clamp(56px, 8vw, 104px) var(--pad) clamp(40px, 5vw, 64px); }
.section-head .title { margin-top: 18px; }
.section-head p { margin: 16px auto 0; max-width: 34em; color: var(--muted); }

/* ---------- header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 0 var(--gutter);
}

.site-header .bar {
  display: flex; align-items: center; gap: 32px;
  max-width: var(--wrap); margin: 0 auto; height: 64px;
}

.wordmark {
  display: inline-flex; align-items: center; min-height: 44px;
  font-size: 21px; font-weight: 600; letter-spacing: -0.04em;
  color: var(--accent); text-decoration: none;
}

.nav { display: flex; align-items: center; gap: 26px; }
.nav a { padding: 12px 0; font-size: 15px; font-weight: 500; text-decoration: none; color: var(--ink); opacity: .78; transition: opacity .15s, color .15s; }
.nav a:hover, .nav a[aria-current="true"] { opacity: 1; color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  background: none; border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink); cursor: pointer; transition: border-color .15s;
}
.icon-btn:hover { border-color: var(--line-strong); }
.icon-btn svg { width: 17px; height: 17px; }

.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}

.menu-toggle { display: none; }
.header-cta { min-height: 44px !important; padding: 0 16px !important; font-size: 14px !important; }

@media (max-width: 820px) {
  .menu-toggle { display: inline-grid; }
  .header-cta { display: none !important; }
  .nav {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 4px var(--gutter) 12px;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 14px 0; font-size: 17px; opacity: 1; border-bottom: 1px solid var(--line); }
  .nav a:last-child { border-bottom: 0; }
}

/* ---------- buttons & links ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  font: 500 16px/1 var(--sans);
  text-decoration: none; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 4px;
  background: var(--bg); color: var(--ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / .04);
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-solid:hover { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: transparent; }
.btn svg { width: 16px; height: 16px; }

.links { display: flex; flex-wrap: wrap; gap: 0 22px; list-style: none; padding: 0; margin: 0; }
.links a {
  display: inline-flex; align-items: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 0;
  font: 500 14px/1 var(--mono); text-decoration: none; color: var(--muted);
  transition: color .15s;
}
.links a:hover { color: var(--accent); }

/* ---------- hero ---------- */

.hero .wrap {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  min-height: min(680px, calc(100svh - 64px));
}

.hero-copy { display: flex; flex-direction: column; justify-content: center; padding: var(--pad); }

.hero h1 {
  margin-top: 22px;
  font-size: clamp(44px, 5.6vw, 76px); line-height: .98;
  letter-spacing: -0.055em;
}
.hero h1 em { font-style: normal; color: var(--accent); }

.hero .lede { margin-top: 26px; max-width: 30em; font-size: 19px; line-height: 1.55; color: var(--muted); }
.hero .lede strong { color: var(--ink); font-weight: 500; }

.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.hero .links { margin-top: 22px; }

.hero-art {
  position: relative; overflow: hidden;
  border-left: 1px solid var(--line);
  display: grid; place-items: center; padding: var(--pad);
  background-color: var(--bg-soft);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 36px 36px;
  background-position: -1px -1px;
}
.hero-art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 70% 35%, transparent 30%, var(--bg-soft) 85%);
}

.portrait { position: relative; z-index: 1; margin: 0; width: min(100%, 360px); }
.portrait img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 46% 20%;
  border: 1px solid var(--line-strong); border-radius: 6px;
  box-shadow: 0 24px 48px -24px rgb(0 0 0 / .25);
}

.code-card {
  position: absolute; z-index: 2; left: -22%; bottom: -22px;
  width: min(370px, 104%);
  background: var(--code-bg); color: var(--code-ink);
  border: 1px solid rgb(255 255 255 / .08); border-radius: 8px;
  box-shadow: 0 24px 48px -16px rgb(0 0 0 / .35);
  font: 12px/1.65 var(--mono);
}
.code-card .tab {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-bottom: 1px solid rgb(255 255 255 / .08);
  color: #a3a3a3; font-size: 12px;
}
.code-card .tab::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #ff4a1c; }
.code-card pre { margin: 0; padding: 12px 14px 14px; overflow-x: auto; white-space: pre; font: inherit; }
.tk-k { color: #ff7b54; }
.tk-s { color: #a5d6a7; }
.tk-c { color: #8a8a8a; }
.tk-f { color: #90caf9; }

@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; min-height: 0; }
  .hero-art { border-left: 0; border-top: 1px solid var(--line); padding: 48px var(--pad) 72px; }
  .code-card { left: auto; right: -12px; bottom: -40px; }
}
@media (max-width: 520px) {
  .hero-art { padding: 32px 20px 36px; }
  .portrait { width: 100%; }
  .portrait img { aspect-ratio: 1; }
  .code-card { position: relative; left: auto; right: auto; bottom: auto; width: 100%; margin-top: -56px; font-size: 11px; }
}

/* ---------- facts strip ---------- */

.facts .wrap { display: grid; grid-template-columns: minmax(0, .8fr) repeat(3, minmax(0, 1fr)); }
.facts .wrap > div { padding: 28px clamp(16px, 2.4vw, 32px); }
.facts .wrap > div + div { border-left: 1px solid var(--line); }
.facts .label { display: flex; align-items: center; font: 500 13px/1.5 var(--mono); text-transform: uppercase; }
.facts strong { display: block; font-size: clamp(28px, 3.2vw, 40px); font-weight: 400; line-height: 1.05; letter-spacing: -0.04em; }
.facts span.muted { display: block; margin-top: 8px; font-size: 15px; line-height: 1.45; }

@media (max-width: 820px) {
  .facts .wrap { grid-template-columns: 1fr 1fr; }
  .facts .label { display: none; }
  .facts .wrap > div:nth-child(2) { border-left: 0; }
  .facts .wrap > div:nth-child(4) { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- projects ---------- */

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.grid-2 > * { border-bottom: 1px solid var(--line); }
.grid-2 > *:nth-child(odd) { border-right: 1px solid var(--line); }
.grid-2 > *:nth-last-child(-n+2) { border-bottom: 0; }

.project {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  padding: clamp(24px, 3.4vw, 44px); text-decoration: none;
  background: linear-gradient(160deg, transparent 55%, var(--accent-soft));
}
.project .meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.project h3 { margin-top: 14px; font-size: clamp(24px, 2.4vw, 30px); line-height: 1.12; letter-spacing: -0.035em; }
.project p { margin-top: 10px; max-width: 32em; color: var(--muted); font-size: 16px; }
.project .more { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; font: 500 13px/1 var(--mono); color: var(--ink); }
.project .more::after { content: "↗"; color: var(--accent); transition: transform .2s ease-out; }
.project:hover .more::after { transform: translate(2px, -2px); }

.project .shot {
  margin-top: auto; padding-top: 28px;
  margin-bottom: calc(-1 * clamp(24px, 3.4vw, 44px));
}
.project .shot div {
  aspect-ratio: 16 / 9; overflow: hidden;
  border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 8px 8px 0 0;
  background: var(--bg-soft);
  box-shadow: 0 -8px 32px -16px rgb(0 0 0 / .18);
}
.project .shot img {
  width: 100%; height: 100%; object-fit: cover; object-position: top left;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.project:hover .shot img { transform: translateY(-6px); }
.project:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 16px 0 0; }
.tags li {
  font: 12px/1 var(--mono);
  padding: 6px 9px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted);
  background: var(--bg);
}

@media (max-width: 820px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2 > * { border-right: 0 !important; border-bottom: 1px solid var(--line) !important; }
  .grid-2 > *:last-child { border-bottom: 0 !important; }
}

/* ---------- expertise ---------- */

.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.grid-4 > * { padding: clamp(22px, 2.6vw, 32px); border-bottom: 1px solid var(--line); }
.grid-4 > *:not(:nth-child(4n)) { border-right: 1px solid var(--line); }
.grid-4 > *:nth-last-child(-n+4) { border-bottom: 0; }

.service .num { font: 500 12px/1 var(--mono); color: var(--accent); }
.service h3 { margin-top: 18px; font-size: 20px; font-weight: 500; line-height: 1.2; letter-spacing: -0.025em; }
.service p { margin-top: 10px; font-size: 15px; line-height: 1.55; color: var(--muted); }

@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 > * { border-right: 0 !important; border-bottom: 1px solid var(--line) !important; }
  .grid-4 > *:nth-child(odd) { border-right: 1px solid var(--line) !important; }
  .grid-4 > *:nth-last-child(-n+2) { border-bottom: 0 !important; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr; }
  .grid-4 > * { border-right: 0 !important; border-bottom: 1px solid var(--line) !important; }
  .grid-4 > *:last-child { border-bottom: 0 !important; }
}

/* ---------- toolkit ---------- */

.skills { margin: 0; border-top: 1px solid var(--line); }
.skills > div {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
  border-bottom: 1px solid var(--line);
}
.skills > div:last-child { border-bottom: 0; }
.skills dt {
  padding: 22px clamp(20px, 2.6vw, 32px);
  font: 500 13px/1.6 var(--mono); text-transform: uppercase; color: var(--muted);
  border-right: 1px solid var(--line);
}
.skills dd { margin: 0; padding: 16px clamp(20px, 2.6vw, 32px); }
.skills .tags { margin: 0; }
.skills .tags li { font-size: 13px; padding: 8px 11px; color: var(--ink); }

@media (max-width: 640px) {
  .skills > div { grid-template-columns: 1fr; }
  .skills dt { border-right: 0; padding-bottom: 0; }
}

/* ---------- background ---------- */

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: clamp(22px, 2.6vw, 32px); }
.timeline li + li { border-top: 1px solid var(--line); }
.timeline .label { display: block; margin-bottom: 18px; font: 500 13px/1 var(--mono); text-transform: uppercase; color: var(--accent); }
.timeline .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline h4 { margin: 8px 0 4px; font-size: 24px; line-height: 1.2; letter-spacing: -0.035em; }
.timeline .where { font-weight: 500; }
.timeline .where a { text-decoration-color: var(--line-strong); }
.timeline .where a:hover { color: var(--accent); text-decoration-color: currentColor; }
.timeline p { margin-top: 10px; color: var(--muted); font-size: 16px; }

/* ---------- contact ---------- */

.contact .cell { text-align: center; padding-top: clamp(72px, 10vw, 128px); padding-bottom: clamp(72px, 10vw, 128px); }
.contact .title { font-size: clamp(38px, 5.4vw, 68px); margin-top: 18px; }
.contact p { margin: 18px auto 0; max-width: 30em; color: var(--muted); }
.contact .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 32px; }
.contact .links { justify-content: center; margin-top: 18px; }

/* ---------- footer ---------- */

.site-footer { padding: 0 var(--gutter); overflow: hidden; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 22px var(--pad); color: var(--muted); }
.site-footer a { display: inline-block; padding: 12px 0; margin: -12px 0; text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

.giant {
  max-width: var(--wrap); margin: 0 auto;
  font-size: min(19.4vw, 262px); font-weight: 500; line-height: .82;
  letter-spacing: -0.065em; white-space: nowrap;
  color: var(--accent);
  padding: 0 0 .16em;
  user-select: none;
}

/* ---------- project detail ---------- */

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

.detail-head { padding: clamp(32px, 5vw, 64px) var(--pad); }
.detail-head h1 { margin-top: 20px; font-size: clamp(40px, 6vw, 76px); line-height: 1; letter-spacing: -0.05em; }
.detail-head .summary { margin-top: 18px; max-width: 34em; font-size: 19px; color: var(--muted); }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.facts-list { margin: 0; border-right: 1px solid var(--line); }
.facts-list div { padding: 18px var(--pad); border-bottom: 1px solid var(--line); }
.facts-list div:last-child { border-bottom: 0; }
.facts-list dt { font: 500 12px/1 var(--mono); text-transform: uppercase; color: var(--muted); }
.facts-list dd { margin: 10px 0 0; }
.facts-list .tags { margin: 0; }
.detail-body { padding: var(--pad); }
.detail-body p { font-size: 18px; line-height: 1.65; }
.detail-body p + p { margin-top: 1em; }

.screen { padding: var(--pad); background: var(--bg-soft); }
.frame { margin: 0; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--bg); box-shadow: 0 24px 48px -28px rgb(0 0 0 / .3); }
.frame .bar { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.frame .bar i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }

.next { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 32px var(--pad); text-decoration: none; }
.next strong { font-size: clamp(24px, 3.2vw, 38px); font-weight: 400; letter-spacing: -0.04em; line-height: 1.1; }
.next:hover strong { color: var(--accent); }

@media (max-width: 760px) {
  .detail-grid { grid-template-columns: 1fr; }
  .facts-list { border-right: 0; border-bottom: 1px solid var(--line); }
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
  .project:hover .shot img { transform: none; }
}

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

@media (prefers-reduced-motion: no-preference) {

  /* hero entrance */
  @keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
  @keyframes portrait-in { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }
  @keyframes card-in { from { opacity: 0; transform: translate(-16px, 16px); } to { opacity: 1; transform: none; } }
  @keyframes type { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
  @keyframes caret { 50% { opacity: 0; } }
  @keyframes drift { to { background-position: 35px 35px, 35px 35px; } }

  .hero-copy > * { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; }
  .hero-copy > :nth-child(1) { animation-delay: .05s; }
  .hero-copy > :nth-child(2) { animation-delay: .12s; }
  .hero-copy > :nth-child(3) { animation-delay: .22s; }
  .hero-copy > :nth-child(4) { animation-delay: .3s; }
  .hero-copy > :nth-child(5) { animation-delay: .38s; }

  .hero-art { animation: drift 24s linear infinite; }
  .portrait { animation: portrait-in .9s .2s cubic-bezier(.2, .7, .2, 1) both; }
  .code-card { animation: card-in .7s .6s cubic-bezier(.2, .7, .2, 1) both; }
  .code-card .line { display: inline-block; clip-path: inset(0 100% 0 0); animation: type .5s steps(28, end) forwards; }
  .code-card .line:nth-child(1) { animation-delay: .95s; }
  .code-card .line:nth-child(2) { animation-delay: 1.35s; }
  .code-card .line:nth-child(3) { animation-delay: 1.75s; }
  .code-card .line:nth-child(4) { animation-delay: 2.15s; }
  .code-card .line:nth-child(5) { animation-delay: 2.55s; }
  .code-card .caret { display: inline-block; width: .6em; height: 1.1em; margin-left: 2px; vertical-align: -2px; background: var(--accent); opacity: 0; animation: fade-in 0s 3s forwards, caret 1s 3s steps(1) infinite; }

  /* scroll reveals (classes added by main.js) */
  .js .reveal { opacity: 0; transform: translateY(20px); transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .7s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--d, 0s); }
  .js .reveal.in { opacity: 1; transform: none; }

  /* corner marks pop in with their section */
  .js .mark::before, .js .mark::after { transform: scale(0); transition: transform .4s .15s cubic-bezier(.3, 1.6, .5, 1); }
  .js .mark.in::before, .js .mark.in::after { transform: none; }

  /* giant wordmark: letters rise one by one */
  .js .giant .ch { display: inline-block; transform: translateY(100%); transition: transform .8s cubic-bezier(.2, .7, .2, 1); transition-delay: calc(var(--i) * 45ms); }
  .js .giant.in .ch { transform: none; }
}
