/* ═══════════════════════════════════════════════════════════════
   Saufik Ramadhan — personal site
   Dense academic / newspaper layout: narrow measure, tight leading,
   hairline rules, information over whitespace.
   Light is the default theme; [data-theme="dark"] flips the tokens.
   ═══════════════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────────────── */
:root {
  --bg:        #fdfcfa;
  --bg-alt:    #f5f3ef;
  --surface:   #ffffff;
  --fg:        #16161a;
  --fg-soft:   #3d3d45;
  --muted:     #77777f;
  --faint:     #9a9aa2;
  --line:      #dedbd4;
  --line-soft: #ebe8e2;
  --accent:    #37527a;
  --accent-bg: #eef1f6;

  --shell: 1020px;
  --gutter: clamp(16px, 3.4vw, 34px);
  --header-h: 50px;
  --label-w: 132px;
  /* Shared left column for periods and years — keeps a vertical rhythm
     across education, experience, electronics, awards and languages. */
  --col-w: 132px;

  --sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
          'Segoe UI', 'Noto Sans KR', 'Hiragino Sans', 'Yu Gothic UI',
          'Microsoft YaHei', 'PingFang SC', Roboto, Helvetica, Arial, sans-serif;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  --mono: 'SF Mono', 'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;
}

:root[data-theme='dark'] {
  --bg:        #131316;
  --bg-alt:    #1a1a1e;
  --surface:   #1c1c21;
  --fg:        #e9e9ec;
  --fg-soft:   #b8b8c0;
  --muted:     #85858e;
  --faint:     #6b6b74;
  --line:      #2e2e35;
  --line-soft: #26262c;
  --accent:    #93b2dd;
  --accent-bg: #1e2735;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 10px);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.is-locked { overflow: hidden; }

img { max-width: 100%; display: block; }
ul, ol { list-style: none; padding: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
dl, dd { margin: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: #fff; }

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

.skip-link { position: absolute; left: -9999px; top: 0; z-index: 200; padding: 8px 14px; background: var(--fg); color: var(--bg); font-size: 12px; }
.skip-link:focus { left: 8px; top: 8px; }

/* ── Shared bits ─────────────────────────────────────────────── */
.label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--faint);
}

/* Comma-separated inline lists — denser than pills. */
.inline-list { display: inline; color: var(--fg-soft); }
.inline-list li { display: inline; }
.inline-list li:not(:last-child)::after { content: ',\00a0'; color: var(--faint); }

.meta-line { margin-top: 5px; font-size: 12.5px; line-height: 1.5; }
.meta-line .label { margin-right: 8px; }

.link-more { color: var(--accent); border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.link-more:hover { border-bottom-color: var(--accent); }

/* ── Header ──────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.header__inner { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.brand { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; }
.brand__mark { width: 7px; height: 7px; background: var(--accent); transform: rotate(45deg); }
.brand__name { font-size: 13px; font-weight: 700; letter-spacing: -0.01em; }

.nav { display: none; }
@media (min-width: 1000px) { .nav { display: block; } }

.nav__list { display: flex; align-items: center; gap: 1px; }
.nav__link {
  display: block;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1.5px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.nav__link:hover { color: var(--fg); }
.nav__link.is-active { color: var(--fg); font-weight: 600; border-bottom-color: var(--accent); }

.header__tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px; height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--fg-soft);
  transition: border-color 0.15s, color 0.15s;
}
.icon-btn:hover { border-color: var(--fg); color: var(--fg); }
.icon { grid-area: 1 / 1; }
:root[data-theme='light'] .icon--moon { display: none; }
:root[data-theme='dark']  .icon--sun  { display: none; }

/* Language switcher */
.lang { position: relative; }
.lang__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--fg-soft);
  transition: border-color 0.15s, color 0.15s;
}
.lang__btn:hover { border-color: var(--fg); color: var(--fg); }

.lang__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 168px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  box-shadow: 0 10px 26px -14px rgb(0 0 0 / 0.32);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.14s, visibility 0.14s;
}
.lang.is-open .lang__menu { opacity: 1; visibility: visible; }

.lang__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 6px 9px;
  border-radius: 3px;
  font-size: 12.5px;
  color: var(--fg-soft);
  text-align: left;
}
.lang__option:hover { background: var(--bg-alt); color: var(--fg); }
.lang__option[aria-selected='true'] { color: var(--fg); font-weight: 700; }
.lang__option[aria-selected='true']::after { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.lang__code { font-size: 10px; letter-spacing: 0.09em; color: var(--faint); }
.lang__option[aria-selected='true'] .lang__code { display: none; }

/* Mobile menu button */
.menu-btn {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 30px; height: 30px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
@media (min-width: 1000px) { .menu-btn { display: none; } }
.menu-btn__bar { display: block; height: 1.4px; background: var(--fg); transition: transform 0.2s, opacity 0.2s; }
.menu-btn__bar:first-child { width: 100%; }
.menu-btn__bar:last-child { width: 62%; align-self: flex-end; }
.menu-btn[aria-expanded='true'] .menu-btn__bar:first-child { transform: translateY(2.7px) rotate(45deg); }
.menu-btn[aria-expanded='true'] .menu-btn__bar:last-child { width: 100%; transform: translateY(-2.7px) rotate(-45deg); }

.progress { position: absolute; left: 0; bottom: -1px; height: 1.5px; width: 0; background: var(--accent); transition: width 0.1s linear; }

.mobile-menu {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 99;
  background: var(--bg);
  padding: 8px var(--gutter) 32px;
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.16s;
}
.mobile-menu.is-open { opacity: 1; }
.mobile-menu__link {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 16px;
  font-weight: 500;
}
.mobile-menu__num { font-family: var(--mono); font-size: 10px; color: var(--faint); }

/* ── Masthead ────────────────────────────────────────────────── */
.masthead {
  padding-top: calc(var(--header-h) + 34px);
  padding-bottom: 26px;
  border-bottom: 3px double var(--line);
}

.masthead__grid { display: grid; gap: 22px; }
@media (min-width: 760px) {
  .masthead__grid { grid-template-columns: minmax(0, 1fr) 262px; gap: 34px; align-items: start; }
}

.masthead__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 9px;
  font-size: 11.5px;
  color: var(--muted);
}
.dot { width: 5px; height: 5px; border-radius: 50%; background: #3f9d6d; flex-shrink: 0; }

.masthead__name {
  font-family: var(--serif);
  font-size: clamp(31px, 5.2vw, 46px);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.02em;
}
.masthead__role {
  margin-top: 4px;
  font-size: clamp(14px, 1.8vw, 16px);
  font-weight: 500;
  color: var(--accent);
}
.masthead__tagline {
  margin-top: 12px;
  max-width: 60ch;
  font-size: 14px;
  line-height: 1.62;
  color: var(--fg-soft);
}

/* Contact block — compact definition list, academic-directory style. */
.masthead__meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 14px;
  align-content: start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--bg-alt);
  font-size: 12.5px;
}
.masthead__meta dt { padding-top: 2px; }
.masthead__meta dd { color: var(--fg-soft); overflow-wrap: anywhere; }
.masthead__meta a { border-bottom: 1px solid var(--line); }
.masthead__meta a:hover { border-bottom-color: var(--fg); color: var(--fg); }

/* ── Section frame ───────────────────────────────────────────── */
.section { padding: 26px 0; border-bottom: 1px solid var(--line); }
.section:nth-of-type(even) { background: var(--bg-alt); }

.section__grid { display: grid; gap: 10px; }
@media (min-width: 780px) {
  .section__grid { grid-template-columns: var(--label-w) minmax(0, 1fr); gap: 26px; }
}

.section__head { display: flex; align-items: baseline; gap: 8px; }
@media (min-width: 780px) {
  .section__head { position: sticky; top: calc(var(--header-h) + 22px); display: block; align-self: start; }
}
.section__num { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; color: var(--accent); }
.section__title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
@media (min-width: 780px) { .section__title { margin-top: 1px; } }

.section__body { min-width: 0; }

/* ── About ───────────────────────────────────────────────────── */
.prose p { font-size: 14px; line-height: 1.68; color: var(--fg-soft); }
.prose p + p { margin-top: 9px; }
@media (min-width: 900px) {
  /* Newspaper columns keep the measure readable at this width. */
  .prose { columns: 2; column-gap: 30px; column-rule: 1px solid var(--line-soft); }
  .prose p { break-inside: avoid; }
}

.deflist {
  display: grid;
  gap: 0;
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
}
.deflist__row { display: grid; gap: 1px 14px; padding: 5px 0; border-bottom: 1px dotted var(--line); }
.deflist__row:last-child { border-bottom: 0; }
/* Same left column as the entry/row lists, so the labels line up with the
   period column of the sections below. */
@media (min-width: 560px) { .deflist__row { grid-template-columns: var(--col-w) minmax(0, 1fr); align-items: baseline; } }

/* ── Entries (education / experience / electronics) ──────────── */
.entries { display: grid; }
.entry { display: grid; gap: 1px 18px; padding: 11px 0; border-bottom: 1px dotted var(--line); }
.entry:first-child { padding-top: 0; }
.entry:last-child { border-bottom: 0; padding-bottom: 0; }
@media (min-width: 620px) {
  .entry { grid-template-columns: var(--col-w) minmax(0, 1fr); }
  .entry__period { padding-top: 3px; }
}

.entry__period { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.01em; color: var(--muted); }
.entry__main { min-width: 0; }
.entry__title { font-size: 15px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.35; }
.entry__sub { font-size: 13px; color: var(--accent); }
.entry__place { font-size: 12px; color: var(--faint); }
.entry__detail { margin-top: 3px; font-size: 13px; line-height: 1.55; color: var(--fg-soft); }
.entry__thesis { font-style: italic; color: var(--fg-soft); }

.bullets { margin-top: 5px; }
.bullets li { position: relative; padding-left: 13px; font-size: 13px; line-height: 1.55; color: var(--fg-soft); }
.bullets li + li { margin-top: 2px; }
.bullets li::before { content: '·'; position: absolute; left: 3px; color: var(--faint); }

/* ── 3D gallery ──────────────────────────────────────────────── */
.gallery { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); }

.piece { display: flex; flex-direction: column; border: 1px solid var(--line); background: var(--surface); }
.piece:hover { border-color: var(--accent); }

.piece__cover { aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-alt); border-bottom: 1px solid var(--line); }
.piece__cover img, .piece__cover svg { width: 100%; height: 100%; object-fit: cover; display: block; }

.piece__thumbs { display: flex; gap: 3px; padding: 5px 5px 0; }
.piece__thumb {
  width: 34px; height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  overflow: hidden;
  opacity: 0.55;
  transition: opacity 0.15s, border-color 0.15s;
}
.piece__thumb:hover { opacity: 0.85; }
.piece__thumb.is-on { opacity: 1; border-color: var(--accent); }
.piece__thumb img { width: 100%; height: 100%; object-fit: cover; }

.piece__body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.piece__year { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; color: var(--faint); }
.piece__title { font-size: 13.5px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.3; }
.piece__desc { font-size: 12.5px; line-height: 1.5; color: var(--fg-soft); }
.piece__foot { margin-top: auto; padding-top: 5px; }

/* ── Rows (certifications / awards) ──────────────────────────── */
.rows { display: grid; }
.row { display: grid; gap: 1px 18px; padding: 8px 0; border-bottom: 1px dotted var(--line); }
.row:first-child { padding-top: 0; }
.row:last-child { border-bottom: 0; padding-bottom: 0; }
@media (min-width: 620px) {
  .row { grid-template-columns: var(--col-w) minmax(0, 1fr) auto; align-items: baseline; }
}
.row__year { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.row__name { font-size: 14px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.4; }
.row__sub { font-size: 12.5px; color: var(--fg-soft); }
.row__note { font-size: 11.5px; font-family: var(--mono); color: var(--faint); }
.row__desc { font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.row__aside { font-size: 12px; }

/* ── Language proficiency ────────────────────────────────────── */
.langs { display: grid; gap: 0; }
.lang-row { display: grid; gap: 2px 18px; padding: 8px 0; border-bottom: 1px dotted var(--line); align-items: baseline; }
.lang-row:first-child { padding-top: 0; }
.lang-row:last-child { border-bottom: 0; padding-bottom: 0; }
@media (min-width: 620px) { .lang-row { grid-template-columns: var(--col-w) minmax(0, 1fr) 104px; } }

.lang-row__name { font-size: 14px; font-weight: 700; }
.lang-row__note { font-size: 12.5px; color: var(--fg-soft); }
.lang-row__score { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.lang-row__score::before { content: ' · '; }
.meter { display: flex; gap: 3px; }
.meter__seg { width: 16px; height: 4px; background: var(--line); }
.meter__seg.is-on { background: var(--accent); }

/* ── Footer ──────────────────────────────────────────────────── */
.footer { padding: 26px 0 20px; background: var(--bg); }
.footer__top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; padding-bottom: 18px; }
.footer__kicker { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.footer__mail { font-size: 15px; color: var(--accent); border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); word-break: break-all; }
.footer__mail:hover { border-bottom-color: var(--accent); }

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 20px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--faint);
}
.footer__links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer__links a:hover { color: var(--fg); }

/* ── Reveal (opacity only — no motion in a dense layout) ─────── */
.reveal { opacity: 0; transition: opacity 0.3s ease; }
.reveal.is-visible { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; } }

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  .site-header, .mobile-menu, .progress, .footer__top { display: none; }
  .masthead { padding-top: 0; }
  .section { break-inside: avoid; padding: 10px 0; background: none; }
  .section__head { position: static; }
  .reveal { opacity: 1; }
  body { font-size: 10.5pt; }
}
