/* Tanoo Mohal: portfolio
   Layout system adapted from dqnamo.com: a narrow column, section header
   (title + muted subtitle), a "tray" holding cards with concentric radii, and a
   "view all" row closing each tray. Greys follow the Radix gray scale; dark is
   the default, light is opt-in via the dock. */

@import url("https://fonts.googleapis.com/css2?family=Instrument+Serif&family=Inter:opsz,wght@14..32,400..600&display=swap");

:root, [data-theme="dark"] {
  --g1: #111111; --g2: #191919; --g3: #222222; --g4: #2a2a2a; --g5: #313131;
  --g6: #3a3a3a; --g7: #484848; --g8: #606060; --g9: #6e6e6e; --g11: #b4b4b4; --g12: #eeeeee;
  --page: var(--g1);
  --tray: #151515;
  --card: var(--g2);
  --preview: var(--g3);
  --btn-dark-bg: var(--g12); --btn-dark-fg: var(--g1);
  --green-bg: #132d21; --green-fg: #3dd68c;
  color-scheme: dark;
}
[data-theme="light"] {
  --g1: #fcfcfc; --g2: #f9f9f9; --g3: #f0f0f0; --g4: #e8e8e8; --g5: #e0e0e0;
  --g6: #d9d9d9; --g7: #cecece; --g8: #bbbbbb; --g9: #8d8d8d; --g11: #646464; --g12: #202020;
  --page: #fafafa;
  --tray: var(--g2);
  --card: #ffffff;
  --preview: var(--g2);
  --btn-dark-bg: var(--g12); --btn-dark-fg: #fff;
  --green-bg: #e6f6eb; --green-fg: #218358;
  color-scheme: light;
}
:root {
  --sans: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  /* concentric radii: tray 18 = card 13 + 5 padding */
  --r-tray: 18px; --tray-pad: 5px; --r-card: 13px; --r-inner: 9px;
  --ease: cubic-bezier(.23, 1, .32, 1);
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);
  --col: 840px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body { background: var(--page); color: var(--g12); font: 14px/1.5 var(--sans); letter-spacing: -.006em; transition: background .3s, color .3s; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--g12); color: var(--g1); }
:focus-visible { outline: 2px solid var(--g8); outline-offset: 2px; border-radius: 6px; }

@view-transition { navigation: auto; }

main { max-width: var(--col); margin: 0 auto; padding: 56px 20px 160px; display: grid; gap: 72px; }

/* ---------- Header ---------- */
.site-head .mark { font: 34px/1 var(--serif); letter-spacing: -.01em; }
.site-head .sub { color: var(--g9); font-size: 12px; margin-top: 4px; }

/* ---------- Section header ---------- */
.sec > .head { padding: 0 6px 14px; }
.sec > .head h2 { font-size: 14px; font-weight: 500; }
.sec > .head p { color: var(--g11); }
.page-title { font-size: 14px; font-weight: 500; }

/* ---------- Tray + cards ---------- */
.tray { background: var(--tray); border: 1px solid var(--g3); border-radius: var(--r-tray); padding: var(--tray-pad); display: grid; gap: var(--tray-pad); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--tray-pad); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--tray-pad); }
.card {
  background: var(--card); border: 1px solid var(--g4); border-radius: var(--r-card);
  box-shadow: 0 1px 2px #0000000a; overflow: hidden; display: flex; flex-direction: column;
}
.card .preview { margin: 4px; border-radius: var(--r-inner); background: var(--preview); aspect-ratio: 16 / 10; overflow: hidden; display: grid; place-items: center; position: relative; }
.card .preview img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.card:hover .preview img { transform: scale(1.03); }
.card .preview .mono { font: 44px/1 var(--serif); color: var(--g12); }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { font-size: 14px; font-weight: 500; }
.card p { color: var(--g11); font-size: 12.5px; line-height: 1.6; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 5px; background: var(--g3); color: var(--g11); }
.tag.green { background: var(--green-bg); color: var(--green-fg); }

/* Full-width link row inside a card, and the tray's closing "view all" row */
.rowlink {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; margin-top: auto;
  border: 1px solid var(--g4); border-radius: 8px; color: var(--g11); font-size: 13px;
  transition: background .2s, color .2s;
}
.rowlink:hover { background: var(--g3); color: var(--g12); }
.rowlink .arr, .viewall .arr { margin-left: auto; transition: transform .3s var(--ease); }
.rowlink:hover .arr, .viewall:hover .arr { transform: translateX(2px); }
.viewall {
  display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px 0 8px;
  background: var(--card); border: 1px solid var(--g4); border-radius: var(--r-card); font-size: 13.5px;
  transition: background .2s;
}
.viewall:hover { background: var(--g3); }
.count { min-width: 24px; height: 24px; padding: 0 6px; border-radius: 7px; display: grid; place-items: center; background: var(--g12); color: var(--g1); font-size: 11px; font-weight: 500; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 7px; font-size: 13px; border: 1px solid var(--g5); color: var(--g12); background: var(--card); transition: background .2s, transform .2s var(--ease); }
.btn:hover { background: var(--g3); }
.btn:active { transform: scale(.97); }
.btn.dark { background: var(--btn-dark-bg); color: var(--btn-dark-fg); border-color: transparent; }
.btn.dark:hover { opacity: .9; }
.btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Hero tray ---------- */
.hero .intro { padding: 22px 20px 20px; justify-content: space-between; gap: 18px; }
.hero .intro h1 { font-size: 14px; font-weight: 500; }
.hero .intro p { font-size: 14px; color: var(--g11); max-width: 360px; margin-top: 4px; }
.hero .photo { position: relative; min-height: 250px; }
.hero .photo img { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); object-fit: cover; border-radius: var(--r-inner); }
.hero .photo .cap { position: absolute; left: 12px; bottom: 12px; font-size: 11px; color: #fff; background: #0008; padding: 2px 8px; border-radius: 6px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

/* ---------- Flip book (lives inside a card) ---------- */
.book-card { padding: 22px 16px 14px; align-items: center; overflow: visible; } /* overflow:hidden here flattens the page-turn 3D */
.book { position: relative; width: 100%; aspect-ratio: 3 / 2; perspective: 2400px; transition: transform .9s var(--ease); touch-action: pan-y; user-select: none; }
.book.closed { transform: translateX(-25%); }
.book.end { transform: translateX(25%); }
.book::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 50px; transform: translateX(-50%); background: linear-gradient(90deg, transparent, #0000003d 50%, transparent); z-index: 999; pointer-events: none; }
.leaf { position: absolute; top: 0; left: 50%; width: 50%; height: 100%; transform-origin: left center; transform-style: preserve-3d; transition: transform 1s cubic-bezier(.645, .045, .355, 1); cursor: grab; }
.leaf.dragging { transition: none; cursor: grabbing; }
.leaf .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; background: var(--preview); }
.leaf .face.front { border-radius: 0 var(--r-inner) var(--r-inner) 0; }
.leaf .face.back { transform: rotateY(180deg); border-radius: var(--r-inner) 0 0 var(--r-inner); }
.leaf .face img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.leaf .face.front::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #0006, transparent 12%); pointer-events: none; }
.leaf .face.back::after { content: ""; position: absolute; inset: 0; background: linear-gradient(270deg, #0006, transparent 12%); pointer-events: none; }
.leaf .cap { position: absolute; left: 10px; bottom: 10px; font-size: 11px; color: #fff; background: #0008; padding: 2px 8px; border-radius: 6px; }
.leaf .cap:empty { display: none; }
.cover { height: 100%; padding: 22px; display: flex; flex-direction: column; justify-content: space-between; background: var(--card); border: 1px solid var(--g4); border-radius: inherit; }
.cover .mark { font: 32px/1 var(--serif); }
.cover small { color: var(--g9); font-size: 12px; }
.book-bar { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 16px; }
.book-bar .progress { flex: 1; height: 3px; border-radius: 3px; background: var(--g4); overflow: hidden; }
.book-bar .progress i { display: block; height: 100%; width: 0; background: var(--g12); transition: width .6s var(--ease); }
.book-bar .pageno { font: 11px var(--mono); color: var(--g9); min-width: 52px; text-align: right; }
.iconbtn { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--g5); border-radius: 7px; background: var(--card); color: var(--g11); transition: background .2s, color .2s; }
.iconbtn:hover { background: var(--g3); color: var(--g12); }

/* ---------- Experience rows ---------- */
.xp { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: start; padding: 12px; }
.xp .logo { width: 36px; height: 36px; border-radius: 9px; background: var(--g3); display: grid; place-items: center; font-weight: 600; font-size: 13px; color: var(--g11); }
.xp h3 { font-size: 14px; font-weight: 500; }
.xp .org { color: var(--g11); font-size: 13px; }
.xp .when { color: var(--g9); font-size: 12px; font-family: var(--mono); white-space: nowrap; }
.xp ul { margin-top: 8px; padding-left: 16px; color: var(--g11); font-size: 13px; display: grid; gap: 4px; }

/* ---------- Gallery ---------- */
.masonry { columns: 3 220px; column-gap: var(--tray-pad); }
.masonry figure { break-inside: avoid; margin-bottom: var(--tray-pad); padding: 4px; background: var(--card); border: 1px solid var(--g4); border-radius: var(--r-card); cursor: zoom-in; }
.masonry img { width: 100%; border-radius: var(--r-inner); }
.masonry figcaption { font-size: 12px; color: var(--g11); padding: 6px 6px 2px; }

/* ---------- Filters (segmented) ---------- */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--g3); }
.seg button { height: 26px; padding: 0 10px; border-radius: 7px; font-size: 12.5px; color: var(--g11); transition: background .2s, color .2s; }
.seg button.on { background: var(--card); color: var(--g12); box-shadow: 0 1px 2px #0000001a, 0 0 0 1px var(--g4); }
.card.hide { display: none; }

/* ---------- Dock ---------- */
.dock {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 50;
  display: flex; gap: 2px; padding: 5px; border-radius: 16px;
  background: #161616; border: 1px solid #2a2a2a; box-shadow: 0 10px 30px -10px #0008;
}
.dock a, .dock button { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: #8d8d8d; transition: background .2s, color .2s, transform .25s var(--ease); }
.dock a:hover, .dock button:hover { background: #2a2a2a; color: #eee; }
.dock a:active, .dock button:active { transform: scale(.92); }
.dock a.on { background: #2a2a2a; color: #eee; }
.dock svg { width: 17px; height: 17px; }
.dock .sep { width: 1px; margin: 8px 3px; background: #2a2a2a; }
.dock [data-tip] { position: relative; }
.dock [data-tip]::after { content: attr(data-tip); position: absolute; bottom: 46px; left: 50%; transform: translate(-50%, 4px); padding: 3px 8px; border-radius: 6px; background: #eee; color: #111; font-size: 11.5px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s, transform .2s var(--ease); }
.dock [data-tip]:hover::after { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: #000000e6; opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 92vw; max-height: 82vh; border-radius: 10px; transform: scale(.97); transition: transform .4s var(--ease-drawer); }
.lightbox.open img { transform: none; }
.lightbox .bar { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 12px; background: #161616; border: 1px solid #2a2a2a; color: #eee; }
.lightbox .bar button { width: 32px; height: 32px; border-radius: 8px; color: #b4b4b4; }
.lightbox .bar button:hover { background: #2a2a2a; color: #eee; }
.lightbox .lb-cap { padding: 0 10px; font-size: 12.5px; color: #b4b4b4; min-width: 120px; text-align: center; }

/* ---------- Motion ---------- */
.reveal { opacity: 0; transform: translateY(8px); transition: opacity .6s var(--ease), transform .6s var(--ease); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 720px) {
  main { padding-top: 36px; gap: 56px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .book { aspect-ratio: 3 / 2.3; }
  .xp { grid-template-columns: 36px 1fr; }
  .xp .when { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
}
