/* Shot by Sudharsan — warm paper, quiet serif, white cards, left icon rail. */

:root {
  --bg: #f3f0e9;
  --card: #ffffff;
  --card-border: rgba(120, 108, 88, 0.14);
  --ink: #3a352c;
  --body: #4a4438;
  --muted: #a09a8c;
  --accent: #6b8f3d;
  --rail-active-bg: #ffffff;
  --pill: rgba(120, 108, 88, 0.10);
  --rail-group-bg: rgba(120, 108, 88, 0.12);
  --serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Helvetica, Arial, sans-serif;
  --radius: 24px;
}

[data-theme="dark"] {
  --bg: #191c10;
  --card: #23261a;
  --card-border: rgba(242, 238, 226, 0.10);
  --ink: #f2eee2;
  --body: #d8d2c0;
  --muted: #8a866f;
  --accent: #9dbb63;
  --rail-active-bg: #2c3020;
  --pill: rgba(242, 238, 226, 0.10);
  --rail-group-bg: rgba(242, 238, 226, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* Subtle paper grain over the warm background. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
}

body {
  font-family: var(--serif);
  background: var(--bg);
  color: var(--body);
  line-height: 1.65;
  min-height: 100vh;
  transition: background 0.25s ease, color 0.25s ease;
}

/* ---------- Left icon rail ---------- */
.rail {
  position: fixed;
  left: 60px;
  top: 18vh;
  display: flex;
  flex-direction: column;
  gap: 0;
  z-index: 50;
}

/* Ghost container around the nav icons: invisible at rest, materializes as
   a soft pill when the rail area is hovered. The theme toggle is deliberately
   detached below it. */
.rail-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  transition: background 0.3s ease;
}

.rail-group:hover { background: var(--rail-group-bg); }

/* Hovering the group area brightens the icons a touch; the hovered icon
   still gets its full treatment, and the active tile keeps its accent. */
.rail-group:hover .rail-btn:not(:hover):not(.is-active) { color: var(--body); }

/* The theme toggle sits a clear step below the nav group. */
#theme-toggle { margin-top: 20px; }

.rail-btn {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

/* Hover: icon darkens. The active tile is never altered on hover. */
.rail-btn:hover { color: var(--ink); }

/* Plain-text label that drifts in and fades to the right of the icon on hover. */
.rail-tip {
  position: absolute;
  left: calc(100% + 16px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.rail-btn:hover .rail-tip,
.rail-btn:focus-visible .rail-tip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* The icon itself pops ~8% on hover — the signature of the animation. */
.rail-btn svg {
  width: 24px;
  height: 24px;
  transform: scale(1);
  transition: transform 0.3s cubic-bezier(0, 0, 0.2, 1);
}

.rail-btn:hover svg { transform: scale(1.08); }

/* ---------- Rail icon micro-animations (one shot per hover) ---------- */

/* Home: the door swings open on its left hinge, revealing a dark doorway;
   it swings shut lazily when the hover leaves. */
.rail-btn .door {
  transform-box: fill-box;
  transform-origin: left center;
  transition: transform 1.4s ease;
}
.rail-btn .doorway {
  opacity: 0;
  transition: opacity 0.9s ease;
}
.rail-btn:hover .door { transform: scaleX(0.02); transition: transform 0.45s ease; }
.rail-btn:hover .doorway { opacity: 1; transition: opacity 0.25s ease 0.1s; }

/* About: the head glances up and to the right with a slight tilt, then
   settles back when the hover leaves. */
.rail-btn .head {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.6s ease;
}
.rail-btn:hover .head { transform: translate(1.4px, -1.6px) rotate(9deg); }

/* Photos: the flash blooms in the lens once per hover, then fades. */
.rail-btn .flash {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}
.rail-btn:hover .flash { animation: rail-flash 0.9s ease-out; }
@keyframes rail-flash {
  0% { opacity: 0; transform: scale(0.4); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: scale(2.4); }
}

/* Theme toggle: a quick wobble once per hover. */
#theme-toggle:hover svg { animation: rail-wobble 0.7s ease; }
@keyframes rail-wobble {
  0% { transform: scale(1.08) rotate(0deg); }
  40% { transform: scale(1.08) rotate(24deg); }
  100% { transform: scale(1.08) rotate(0deg); }
}

.rail-btn.is-active {
  background: var(--rail-active-bg);
  color: var(--accent);
  box-shadow: 0 2px 10px rgba(60, 50, 35, 0.10);
}

[data-theme="dark"] .rail-btn.is-active {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

/* Theme toggle shows sun in light mode, moon in dark mode. */
#theme-toggle .icon-moon { display: none; }
[data-theme="dark"] #theme-toggle .icon-sun { display: none; }
[data-theme="dark"] #theme-toggle .icon-moon { display: block; }

/* ---------- Page column ---------- */
.page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.view[hidden] { display: none; }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 56px; }

.hero h1 {
  font-size: 30px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.hero .intro {
  margin-top: 14px;
  font-size: 19px;
  color: var(--muted);
  max-width: 500px;
}

.hero .meta {
  margin-top: 18px;
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.page-head { padding: 72px 0 40px; }

.page-head h1 {
  font-size: 30px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.page-head .intro {
  margin-top: 10px;
  font-size: 19px;
  color: var(--muted);
}

.hello-sub {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 26px 28px 30px;
  margin-bottom: 40px;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

/* Text tabs: plain text, active = bold dark, inactive = muted. */
.tabs { display: flex; gap: 22px; }

.tab {
  background: none;
  border: none;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 0;
}

.tab.is-active { color: var(--ink); font-weight: 700; }
.tab:hover { color: var(--ink); }

.card-arrows { display: flex; gap: 4px; }

.head-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.view-all {
  background: none;
  border: none;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 2px;
}

.view-all:hover { color: var(--ink); text-decoration: underline; }

.arrow {
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  border-radius: 10px;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.arrow:hover:not(:disabled) { background: var(--pill); color: var(--ink); }
.arrow:disabled { opacity: 0.3; cursor: default; }

.card-empty {
  color: var(--muted);
  font-size: 16px;
  padding: 12px 0 4px;
}

/* ---------- Photoset carousel ---------- */
.carousel {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  margin: 0 -28px;
  padding: 4px 28px 8px;
}

.carousel::-webkit-scrollbar { display: none; }
.carousel[hidden] { display: none; }

.set-card {
  position: relative;
  flex: 0 0 auto;
  width: 200px;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  padding: 0;
  font-family: var(--serif);
}

.set-thumb {
  position: relative;
  display: block;
  width: 200px;
}

.set-thumb img {
  display: block;
  width: 200px;
  height: 250px;
  object-fit: cover;
  border-radius: 12px;
  background: var(--pill);
  transition: transform 0.2s ease;
}

.set-card:hover .set-thumb img { transform: translateY(-3px); }

.set-label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: #3a352c;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
}

.set-count {
  display: block;
  margin-top: 8px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Photostream (vertical, generous air) ---------- */
.stream[hidden] { display: none; }

.photo { margin: 0 0 56px; }
.photo:last-child { margin-bottom: 6px; }

.stream-full .photo { margin-bottom: 72px; }

.photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  background: var(--pill);
  cursor: zoom-in;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.photo:hover img {
  transform: scale(1.004);
  box-shadow: 0 14px 34px rgba(60, 50, 35, 0.14);
}

[data-theme="dark"] .photo:hover img {
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}

.caption {
  margin-top: 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ---------- Filter chip ---------- */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--pill);
  border-radius: 999px;
  padding: 6px 8px 6px 16px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 24px;
}

.filter-chip[hidden] { display: none; }

.filter-chip button {
  border: none;
  background: none;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 50%;
}

.filter-chip button:hover { color: var(--ink); background: var(--card); }

/* ---------- About prose ---------- */
.prose { max-width: 600px; }

.prose p {
  font-size: 19px;
  margin-bottom: 1.2em;
  color: var(--body);
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 40px 0 8px;
  color: var(--muted);
  font-size: 15px;
}

.footer p { margin: 0; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(24, 22, 20, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  overflow: auto;
}

.lightbox[hidden] { display: none; }

.lightbox img {
  max-width: 94vw;
  max-height: 84vh;
  object-fit: contain;
  border-radius: 8px;
  cursor: zoom-in;
  transition: transform 0.25s ease;
}

.lightbox.zoomed img {
  transform: scale(1.8);
  cursor: zoom-out;
}

.lb-caption {
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.65);
  font-family: var(--sans);
  font-size: 14px;
}

.lb-close {
  position: absolute;
  top: 12px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  font-family: var(--sans);
  z-index: 3;
}

.lb-close:hover { opacity: 1; }

.lb-zoom {
  position: absolute;
  top: 16px;
  right: 66px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  font-family: var(--sans);
  z-index: 3;
}

.lb-zoom:hover { background: rgba(0, 0, 0, 0.7); }

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  font-family: var(--sans);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 5px;
  z-index: 3;
}

.lb-nav:hover { background: rgba(0, 0, 0, 0.7); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }

/* ---------- Set sibling navigation ---------- */
.set-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 40px;
}

.set-nav[hidden] { display: none; }

.set-nav-btn {
  border: 1px solid var(--card-border);
  background: var(--card);
  border-radius: 999px;
  padding: 10px 18px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  cursor: pointer;
}

.set-nav-btn[hidden] { display: none; }

.set-nav-btn:hover { border-color: var(--muted); }

/* ---------- Photoset detail ---------- */
.back-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 10px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 15px;
  cursor: pointer;
}

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

/* ---------- Gear ---------- */
.gear-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.gear-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 18px;
}

.gear-card h3 {
  font-family: var(--serif);
  font-size: 19px;
  margin: 0 0 6px;
}

.gear-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-family: var(--sans);
}

/* ---------- About extras ---------- */
.colophon { color: var(--muted); font-size: 15px; }

.about-extra { margin-top: 28px; }

.about-portrait {
  width: 100%;
  max-width: 420px;
  border-radius: 18px;
  display: block;
}

.about-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.about-links a {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--card-border);
  background: var(--card);
  padding: 8px 16px;
  border-radius: 999px;
}

.about-links a:hover { border-color: var(--muted); }

/* ---------- Small screens: rail becomes a bottom bar ---------- */
@media (max-width: 760px) {
  .rail {
    left: 50%;
    top: auto;
    bottom: 14px;
    transform: translateX(-50%);
    flex-direction: row;
    gap: 8px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    padding: 8px 12px;
    box-shadow: 0 8px 28px rgba(60, 50, 35, 0.16);
  }

  .page { padding: 0 18px 120px; }
  .hero, .page-head { padding-top: 52px; }
  .card { padding: 22px 20px 26px; }
  .carousel { margin: 0 -20px; padding: 4px 20px 8px; }

  /* No hover labels on the touch bottom bar. */
  .rail-tip { display: none; }
  #theme-toggle { margin-top: 0; }

  /* The ghost group dissolves on the touch bottom bar. */
  .rail-group { display: contents; }

  /* Declutter the photos card header: touch scrolling needs no chevrons,
     and "View all" stays on one line. */
  .card-arrows { display: none; }
  .view-all { white-space: nowrap; }
}
