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

:root {
  --paper: #f3ecdf;
  --ink: #1a1a1a;
  --body: #2f2d29;
  --soft-text: #7a746b;
  --muted-text: #928a7e;
  --faint-text: #9f9689;
  --rule: #bfae99;
  --soft-rule: #cbbba6;
  --glow-rgb: 113, 96, 73;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Libre Baskerville', Baskerville, serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Layout ── */
.layout {
  display: grid;
  grid-template-columns: 130px 1fr;
  max-width: 820px;
  margin: 0 auto;
  padding: 88px 40px 140px;
}

/* ── Sidebar ── */
.sidebar {
  position: sticky;
  top: 88px;
  height: fit-content;
  align-self: start;
  padding-right: 28px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar a {
  font-size: 12px;
  font-style: italic;
  color: var(--muted-text);
  text-decoration: none;
  transition: color 0.2s;
  display: block;
}

.sidebar a:hover,
.sidebar a.active {
  color: var(--ink);
}

/* ── Main content ── */
main {
  padding-left: 56px;
  border-left: 1px solid var(--rule);
}

/* ── Intro ── */
.intro {
  margin-bottom: 56px;
}

.intro.hidden {
  display: none;
}

.intro h1 {
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.3px;
  margin-bottom: 5px;
}

.intro .subtitle {
  font-size: 11px;
  font-style: italic;
  color: var(--muted-text);
}

/* ── Sections ── */
section {
  display: none;
}

section.active {
  display: block;
}

/* ── View transition crossfade (Josh Bradley style) ── */
main {
  view-transition-name: crossfade;
}

@keyframes hide {
  from { opacity: 1; filter: blur(0); }
  to   { opacity: 0; filter: blur(4px); }
}

@keyframes appear {
  from { opacity: 0; filter: blur(4px); }
  to   { opacity: 1; filter: blur(0); }
}

@supports (view-transition-name: none) {
  @media not (prefers-reduced-motion: reduce) {
    ::view-transition-old(crossfade) {
      animation: 0.4s cubic-bezier(0.6, 0, 0.8, 1) forwards hide;
    }
    ::view-transition-new(crossfade) {
      opacity: 0;
      animation: 0.6s ease 0.2s forwards appear;
    }
  }
}

/* ── Section label ── */
.section-label {
  font-size: 10px;
  font-style: italic;
  color: var(--faint-text);
  margin-bottom: 22px;
}

button.section-label {
  border: none;
  background: transparent;
  font-family: inherit;
  padding: 0;
}

/* ── About ── */
.about-text {
  font-size: 13px;
  line-height: 1.85;
  color: var(--body);
  margin-bottom: 12px;
}

.about-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.about-list li {
  font-size: 13px;
  line-height: 1.75;
  color: var(--soft-text);
  padding-left: 16px;
  position: relative;
}

.about-list li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--faint-text);
}

/* ── Writing ── */
.writing-item {
  display: block;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 4px;
  margin-bottom: 12px;
  color: inherit;
  font: inherit;
  text-align: left;
  background:
    linear-gradient(var(--paper), var(--paper)) padding-box,
    radial-gradient(
      50px circle at var(--x, 50%) var(--y, 50%),
      rgba(var(--glow-rgb), var(--glow, 0)),
      transparent 100%
    ) border-box,
    linear-gradient(var(--soft-rule), var(--soft-rule)) border-box;
  overflow: hidden;
  cursor: pointer;
}

.writing-item:last-child {
  margin-bottom: 0;
}

.writing-content {
  padding: 18px 20px 20px;
}

.writing-title {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 9px;
}

.writing-desc {
  font-size: 12px;
  line-height: 1.75;
  color: var(--soft-text);
}

.writing-list.hidden {
  display: none;
}

.writing-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: default;
  transition: color 0.2s;
}

.writing-back.active {
  cursor: pointer;
}

.writing-back.active:hover {
  color: var(--ink);
}

.writing-back-arrow {
  display: none;
  font-style: normal;
  line-height: 1;
}

.writing-back.active .writing-back-arrow {
  display: inline;
}

.writing-reader {
  display: none;
  border: 1px solid var(--soft-rule);
  border-radius: 4px;
  padding: 26px 28px 30px;
}

.writing-reader.open {
  display: block;
}

.writing-full {
  display: none;
}

.writing-full.active {
  display: block;
}

.writing-full-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 24px;
  margin-bottom: 20px;
}

.writing-full-title {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ink);
}

.writing-full-date {
  font-size: 10px;
  font-style: italic;
  color: var(--faint-text);
  line-height: 1.7;
  white-space: nowrap;
}

.writing-full p {
  font-size: 13px;
  line-height: 1.85;
  color: var(--body);
  margin-bottom: 14px;
}

.writing-full p:last-child {
  margin-bottom: 0;
}

/* ── Section header ── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.section-header .section-label {
  margin-bottom: 0 !important;
}

.resume-link {
  font-size: 10px;
  font-style: italic;
  color: var(--muted-text);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: color 0.2s, background-size 0.25s ease;
}

.resume-link:hover {
  color: var(--ink);
  background-size: 100% 1px;
}

/* ── Experience ── */
.exp-item {
  border: 1px solid transparent;
  border-radius: 3px;
  margin-bottom: 8px;
  cursor: pointer;
  background:
    linear-gradient(var(--paper), var(--paper)) padding-box,
    radial-gradient(
      50px circle at var(--x, 50%) var(--y, 50%),
      rgba(var(--glow-rgb), var(--glow, 0)),
      transparent 100%
    ) border-box,
    linear-gradient(var(--soft-rule), var(--soft-rule)) border-box;
}

.exp-item:last-child { margin-bottom: 0; }

.exp-summary {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.exp-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.exp-company {
  font-size: 13px;
  font-weight: 400;
}

.exp-role {
  font-size: 11px;
  font-style: italic;
  color: var(--muted-text);
}

.exp-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.exp-date {
  font-size: 11px;
  color: var(--faint-text);
  white-space: nowrap;
}

.exp-plus {
  font-size: 16px;
  color: var(--faint-text);
  line-height: 1;
  transition: transform 0.25s ease, color 0.2s;
}

.exp-item.open .exp-plus {
  transform: rotate(45deg);
  color: var(--ink);
}

.exp-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.5s ease;
  width: 100%;
}

.exp-item.open .exp-body {
  grid-template-rows: 1fr;
}

.exp-inner {
  overflow: hidden;
  min-width: 0;
  width: 100%;
}

.exp-desc {
  padding: 12px 18px 16px;
  font-size: 12px;
  color: var(--soft-text);
  line-height: 1.75;
  border-top: 1px solid var(--soft-rule);
  opacity: 0;
  transition: opacity 0.4s ease 0.15s;
}

.exp-item.open .exp-desc {
  opacity: 1;
}

/* ── Education ── */
.edu-item { margin-bottom: 24px; }
.edu-item:last-child { margin-bottom: 0; }

.edu-school {
  font-size: 13px;
  font-weight: 400;
  margin-bottom: 4px;
}

.edu-detail {
  font-size: 11px;
  font-style: italic;
  color: var(--muted-text);
  line-height: 1.7;
}

/* ── Projects ── */
.proj-item {
  display: block;
  border: 1px solid var(--soft-rule);
  border-radius: 4px;
  margin-bottom: 12px;
  text-decoration: none;
  overflow: hidden;
  transition: border-color 0.2s;
}

.proj-item:last-child { margin-bottom: 0; }

.proj-item:hover { border-color: var(--muted-text); }

.proj-image {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-bottom: 1px solid var(--soft-rule);
}

.proj-content {
  padding: 20px 22px 22px;
}

.proj-title {
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 8px;
}

.proj-desc {
  font-size: 12px;
  color: var(--soft-text);
  line-height: 1.75;
}

/* ── About contact line ── */
.about-contact {
  font-size: 11px;
  font-style: italic;
  color: var(--muted-text);
  margin-top: 20px;
}

.about-contact a {
  color: var(--muted-text);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: color 0.2s, background-size 0.25s ease;
}

.about-contact a:hover {
  color: var(--ink);
  background-size: 100% 1px;
}

/* ── GitHub contributions ── */
.github-contrib {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--soft-rule);
}

.github-contrib-label {
  display: inline-block;
  font-size: 10px;
  font-style: italic;
  color: var(--muted-text);
  text-decoration: none;
  margin-bottom: 14px;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: color 0.2s, background-size 0.25s ease;
}

.github-contrib-label:hover {
  color: var(--ink);
  background-size: 100% 1px;
}

.github-contrib-chart {
  min-height: 94px;
}

.github-contrib-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 9px);
  grid-auto-columns: 9px;
  gap: 3px;
}

.github-contrib-day {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  border: 1px solid rgba(var(--glow-rgb), 0.12);
  background: #d2c4b2;
  cursor: default;
  transition: transform 0.15s ease, outline-color 0.15s ease;
}

.github-contrib-day[data-level="1"] { background: #a99172; }
.github-contrib-day[data-level="2"] { background: #83684b; }
.github-contrib-day[data-level="3"] { background: #65482f; }
.github-contrib-day[data-level="4"] { background: #3f2c1d; }

.github-contrib-day:hover,
.github-contrib-day:focus {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
  transform: scale(1.25);
}

.github-contrib-status,
.github-contrib-stats,
.github-contrib-detail {
  font-size: 11px;
  font-style: italic;
  color: var(--muted-text);
  line-height: 1.7;
}

.github-contrib-stats {
  margin-top: 12px;
}

.github-contrib-detail {
  min-height: 18px;
  margin-top: 4px;
}

/* ── Local time ── */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.colon { animation: blink 1s step-end infinite; }
.local-time {
  position: fixed;
  bottom: 32px;
  left: 40px;
  font-size: 11px;
  font-style: italic;
  color: var(--muted-text);
}


/* ── Responsive ── */
@media (max-width: 640px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 48px 24px 100px;
  }

  .sidebar {
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    padding-right: 0;
    padding-bottom: 28px;
    margin-bottom: 44px;
  }

  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 18px;
  }

  main {
    padding-left: 0;
    border-left: none;
  }

  .local-time {
    display: none;
  }
}
