/* Portfolio page: day/night painting behind one content panel. */
:root {
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-text: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ink: #12293f;
  --body: #2f4a62;
  --muted: #5f7891;
  --accent: #b04a36;
  --accent-deep: #8a3526;
  --rule: rgba(18, 41, 63, 0.12);
  --panel: rgba(248, 252, 255, 0.9);
  --chip: rgba(18, 41, 63, 0.06);
  --links-bg: rgba(255, 255, 255, 0.55);
  --card: rgba(255, 255, 255, 0.5);
  --card-hover: rgba(255, 255, 255, 0.75);
  --panel-edge: rgba(255, 255, 255, 0.7);
  --on-accent: #fff;
  color-scheme: light;
}

html[data-theme="night"] {
  --ink: #f4efe3;
  --body: #d3dbea;
  --muted: #9fb0c9;
  --accent: #f2c46d;
  --accent-deep: #ffdca0;
  --rule: rgba(244, 239, 227, 0.14);
  --panel: rgba(5, 21, 48, 0.88);
  --chip: rgba(244, 239, 227, 0.08);
  --links-bg: rgba(255, 255, 255, 0.04);
  --card: rgba(255, 255, 255, 0.03);
  --card-hover: rgba(255, 255, 255, 0.07);
  --panel-edge: rgba(244, 239, 227, 0.12);
  --on-accent: #10203a;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #b6e0fd;
  transition: background-color 700ms ease;
}

html[data-theme="night"] {
  background: #011a3d;
}

/* Two fixed layers that cross-fade; cheaper to scroll than background-attachment: fixed. */
.scenery,
.scene {
  position: fixed;
  inset: 0;
}

.scenery {
  z-index: -1;
  pointer-events: none;
}

.scene {
  background: center bottom / cover no-repeat;
  transition: opacity 700ms ease;
  will-change: opacity;
}

.scene-day {
  background-image: url("../images/lakeside.webp");
}

.scene-night {
  opacity: 0;
  background-image: url("../images/lakeside-night.webp");
}

html[data-theme="night"] .scene-night {
  opacity: 1;
}

html[data-theme="night"] .scene-day {
  opacity: 0;
}

/* Fade text, panels and borders together when the theme flips. */
body,
.wrap,
.wrap h1,
.wrap h2,
.wrap h3,
.wrap a,
.wrap dt,
.wrap b,
.wrap strong,
.project,
.links a,
.tags li,
.theme-toggle {
  transition:
    color 600ms ease,
    background-color 600ms ease,
    border-color 600ms ease;
}

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--accent);
}

.theme-toggle svg {
  grid-area: 1 / 1;
  width: 1.15rem;
  height: 1.15rem;
  transition:
    opacity 400ms ease,
    transform 500ms ease;
}

.theme-toggle .icon-sun,
html[data-theme="night"] .theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(-60deg) scale(0.7);
}

html[data-theme="night"] .theme-toggle .icon-sun {
  opacity: 1;
  transform: none;
}

body {
  margin: 0;
  min-height: 100svh;
  color: var(--body);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-deep);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: rgba(176, 74, 54, 0.22);
}

.wrap {
  width: min(100% - 2rem, 46rem);
  margin: clamp(1.5rem, 6vh, 4rem) auto clamp(4rem, 14vh, 9rem);
  padding: clamp(1.75rem, 5vw, 3.25rem);
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 1.25rem;
  box-shadow: 0 20px 60px rgba(18, 41, 63, 0.12);
  animation: rise 700ms ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* Header */
.name {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.05;
}

.role-line {
  margin: 0.6rem 0 0;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 500;
}

.meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
}

.links a {
  display: inline-block;
  padding: 0.38rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink);
  background: var(--links-bg);
  font-size: 0.9rem;
  font-weight: 500;
  transition:
    border-color 400ms ease,
    color 400ms ease,
    background-color 600ms ease;
}

.links a:hover {
  color: var(--accent);
  border-color: rgba(176, 74, 54, 0.45);
}

.links .primary {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}

.links .primary:hover {
  color: var(--on-accent);
  background: var(--accent-deep);
}

/* Sections */
section {
  margin-top: 2.6rem;
}

h2 {
  margin: 0 0 1rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.about p {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
}

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

.about strong {
  color: var(--ink);
  font-weight: 600;
}

/* Experience */
.job + .job {
  margin-top: 1.6rem;
}

.job-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 1rem;
}

h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 600;
}

h3 span {
  color: var(--muted);
  font-weight: 400;
}

.when {
  color: var(--muted);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.job ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.job li {
  margin-bottom: 0.4rem;
}

.job li::marker {
  color: var(--accent);
}

.job b {
  color: var(--ink);
  font-weight: 600;
}

/* Projects */
.projects {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project {
  padding: 1rem 1.15rem;
  border: 1px solid var(--rule);
  border-radius: 0.8rem;
  background: var(--card);
  transition:
    border-color 400ms ease,
    background-color 600ms ease;
}

.project:hover {
  border-color: rgba(176, 74, 54, 0.35);
  background: var(--card-hover);
}

.project-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.2rem 1rem;
}

.project h3 {
  font-size: 1.02rem;
}

.project-links {
  display: flex;
  gap: 0.9rem;
  font-size: 0.88rem;
  font-weight: 500;
}

.project p {
  margin: 0.35rem 0 0;
  font-size: 0.97rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--chip);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

/* Writing */
.posts {
  margin: 0;
  padding: 0;
  list-style: none;
}

.posts li + li {
  border-top: 1px solid var(--rule);
}

.posts a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.65rem 0;
  color: var(--ink);
  font-weight: 500;
}

.posts a:hover {
  color: var(--accent);
}

.posts time {
  flex: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

/* Skills */
.skills {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 0.55rem 1rem;
  margin: 0;
  font-size: 0.97rem;
}

.skills dt {
  color: var(--ink);
  font-weight: 600;
}

.skills dd {
  margin: 0;
}

.plain {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.97rem;
}

.plain li {
  margin-bottom: 0.35rem;
}

.plain li::marker {
  color: var(--accent);
}

footer {
  margin-top: 2.8rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
}

footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

@media (max-width: 560px) {
  .skills {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .skills dd {
    margin-bottom: 0.7rem;
  }

  .posts a {
    flex-direction: column;
    gap: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
