/* style.css — layout + components for the Éclair personal site.
   Colors come entirely from CSS variables defined in themes.css. */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  transition: background-color .35s ease, color .35s ease;
}

h1, h2, h3 {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

a {
  color: var(--link);
  text-decoration: none;
}
a:hover { color: var(--link-hover); text-decoration: underline; }

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

/* ---------- layout shell ---------- */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ---------- sidebar ---------- */
.sidebar {
  flex: 0 0 240px;
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  transition: background-color .35s ease, border-color .35s ease;
}

.brand { text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand__name {
  font-family: Georgia, serif;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .01em;
}
.brand__real {
  margin-top: .15rem;
  font-size: .9rem;
  color: var(--muted);
}

/* nav */
.nav { display: flex; flex-direction: column; gap: .15rem; }
.nav a {
  display: block;
  padding: .5rem .75rem;
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  transition: background-color .2s ease, color .2s ease;
}
.nav a:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.nav a[aria-current="page"] {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 500;
}

/* push the footer block to the bottom of the sidebar */
.sidebar__spacer { flex: 1 1 auto; }

/* theme switcher */
.themes { display: flex; flex-direction: column; gap: .6rem; }
.themes__label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.swatches { display: flex; gap: .55rem; }
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: transform .15s ease, border-color .15s ease;
}
.swatch:hover { transform: scale(1.12); }
.swatch[aria-pressed="true"] {
  border-color: var(--text);
}

/* name tooltip on hover/focus — reads the button's aria-label.
   Left-anchored so longer names don't clip off the viewport edge. */
.swatch::after {
  content: attr(aria-label);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  white-space: nowrap;
  background: var(--text);
  color: var(--bg);
  font-size: .7rem;
  line-height: 1;
  padding: .3rem .5rem;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 10;
}
.swatch:hover::after,
.swatch:focus-visible::after { opacity: 1; }
[data-family="console"] .swatch::after { border-radius: 0; }
.swatch--terminal    { background: linear-gradient(135deg, #7dff9b 50%, #0b0e0d 50%); }
.swatch--amber       { background: linear-gradient(135deg, #ffc04d 50%, #140d00 50%); }
.swatch--gruvbox     { background: linear-gradient(135deg, #fabd2f 50%, #282828 50%); }
.swatch--tokyonight  { background: linear-gradient(135deg, #7aa2f7 50%, #1a1b26 50%); }
.swatch--catppuccin  { background: linear-gradient(135deg, #cba6f7 50%, #1e1e2e 50%); }
.swatch--forest      { background: linear-gradient(135deg, #4f7a4a 50%, #7fa8c9 50%); }
.swatch--blue-hour   { background: linear-gradient(135deg, #7cbbd8 50%, #233148 50%); }
.swatch--golden-hour { background: linear-gradient(135deg, #e0a44a 50%, #d98c63 50%); }
.swatch--midnight    { background: linear-gradient(135deg, #8a7fd0 50%, #0c0f1a 50%); }

.sidebar__contact {
  font-size: .85rem;
  color: var(--muted);
}
.sidebar__contact a { color: var(--link); }

/* ---------- content ---------- */
.content {
  flex: 1 1 auto;
  padding: 3.5rem clamp(1.5rem, 6vw, 5rem);
  max-width: 820px;
}

.page-header { margin-bottom: 2.5rem; }
.page-header h1 {
  font-size: 2.4rem;
  margin: 0 0 .4rem;
}
.page-header .lede {
  font-size: 1.15rem;
  color: var(--muted);
  margin: 0;
}

section { margin-bottom: 2.75rem; }
section > h2 {
  font-size: 1.45rem;
  margin: 0 0 .75rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}

p { margin: 0 0 1rem; }

.muted { color: var(--muted); }

/* cards / work items */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.1rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
  border-color: var(--accent);
}
.card h3 { margin: 0 0 .4rem; font-size: 1.15rem; }
.card p { margin: 0; font-size: .95rem; color: var(--muted); }
.card a { text-decoration: none; }

.tag {
  display: inline-block;
  font-size: .72rem;
  padding: .15rem .55rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  margin-right: .35rem;
}

/* photo gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .75rem;
}
.gallery figure {
  position: relative;
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  aspect-ratio: 1 / 1;
}
.gallery figure.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: .85rem;
  background: repeating-linear-gradient(
    45deg, var(--surface), var(--surface) 12px,
    var(--surface-2) 12px, var(--surface-2) 24px);
}
.gallery img { width: 100%; height: 100%; object-fit: cover; }

/* caption rides over the bottom of the thumbnail, revealed on hover/focus */
.gallery figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: .9rem .6rem .5rem;
  font-size: .8rem;
  color: var(--text);
  background: linear-gradient(
    to top,
    var(--surface),
    color-mix(in srgb, var(--surface) 70%, transparent) 55%,
    transparent);
  transform: translateY(100%);
  opacity: 0;
  transition: transform .15s ease, opacity .15s ease;
}
.gallery figure:hover figcaption,
.gallery figure:focus-visible figcaption {
  transform: translateY(0);
  opacity: 1;
}
/* keep captions readable for users who prefer no motion */
@media (prefers-reduced-motion: reduce) {
  .gallery figcaption { transition: none; }
}

/* clickable thumbnails (those wired up as buttons by photos.js) */
.gallery figure[role="button"] {
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.gallery figure[role="button"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .25);
  border-color: var(--accent);
}
.gallery figure[role="button"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* lightbox overlay — full-size view of a clicked photo */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  /* tinted with the active theme's background so the overlay matches the page */
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(2px);
}
.lightbox[hidden] { display: none; }
body.lightbox-open { overflow: hidden; }

.lightbox__figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  max-width: 100%;
  max-height: 100%;
}
.lightbox__img {
  max-width: 100%;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
}
.lightbox__caption {
  color: var(--text);
  font-size: .9rem;
  text-align: center;
}
.lightbox__caption[hidden] { display: none; }

.lightbox__close {
  position: absolute;
  top: .75rem;
  right: 1rem;
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.lightbox__close:hover {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.lightbox__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* simple intro list */
.facts { list-style: none; padding: 0; margin: 0; }
.facts li {
  padding: .35rem 0;
  border-bottom: 1px dashed var(--border);
}
.facts li:last-child { border-bottom: 0; }

.page-footer {
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .85rem;
}

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar {
    flex-basis: auto;
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
  }
  .sidebar__spacer { display: none; }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: .25rem;
  }
  .themes { margin-left: auto; }
  .themes__label { display: none; }
  .sidebar__contact { width: 100%; }
  .content { padding: 2rem 1.5rem; }
}

/* ---------- terminal theme (ricing / hackery) ---------- */
/* A dark, monospace, sharp-cornered skin layered on top of the base
   layout. Only colour comes from themes.css; everything structural is here. */

[data-family="console"] body {
  font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", "SF Mono",
               ui-monospace, Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.6;
}

[data-family="console"] ::selection {
  background: var(--accent);
  color: var(--bg);
}

[data-family="console"] h1,
[data-family="console"] h2,
[data-family="console"] h3,
[data-family="console"] .brand__name {
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--accent);
}

/* square every rounded corner off */
[data-family="console"] .card,
[data-family="console"] .nav a,
[data-family="console"] .swatch,
[data-family="console"] .tag,
[data-family="console"] .gallery figure,
[data-family="console"] .lightbox__img,
[data-family="console"] .lightbox__close { border-radius: 0; }

/* brand: ~/ path prompt + blinking block cursor */
[data-family="console"] .brand__name::before { content: "~/ "; color: var(--muted); }
[data-family="console"] .brand__name::after {
  content: "\25ae";              /* ▮ */
  color: var(--accent);
  margin-left: 2px;
  animation: term-blink 1.1s steps(1) infinite;
}
@keyframes term-blink { 50% { opacity: 0; } }
[data-family="console"] .brand__real::before { content: "# "; color: var(--muted); }

/* nav as a prompt-marked command list */
[data-family="console"] .nav a { padding-left: 1.5rem; position: relative; }
[data-family="console"] .nav a::before {
  content: "\00b7";             /* · */
  position: absolute; left: .65rem; color: var(--muted);
}
[data-family="console"] .nav a:hover { background: var(--surface-2); }
[data-family="console"] .nav a:hover::before { content: ">"; color: var(--accent); }
[data-family="console"] .nav a[aria-current="page"] {
  background: transparent; color: var(--accent); font-weight: 700;
}
[data-family="console"] .nav a[aria-current="page"]::before { content: ">"; color: var(--accent); }

/* headings styled like a markdown / shell session */
[data-family="console"] .page-header h1::before { content: "$ "; color: var(--accent-2); }
[data-family="console"] .page-header .lede::before { content: "// "; color: var(--muted); }
[data-family="console"] section > h2 {
  border-bottom-style: dashed;
  text-transform: lowercase;
}
[data-family="console"] section > h2::before { content: "## "; color: var(--muted); }

/* cards as ascii boxes — no float/shadow, just an inverting border */
[data-family="console"] .card:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--accent);
  background: var(--surface-2);
}
[data-family="console"] .card h3::before { content: "[ "; color: var(--muted); }
[data-family="console"] .card h3::after  { content: " ]"; color: var(--muted); }

/* tags as outlined #flags */
[data-family="console"] .tag {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent-2);
}

[data-family="console"] .facts li { border-bottom-style: dashed; }
[data-family="console"] .page-footer { border-top-style: dashed; }
