* { box-sizing: border-box; }
:root { --page-inset: 50px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: 300; color: #000; background: #fff; font-synthesis: none; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button { color: #000; font: inherit; background: none; border: 0; cursor: pointer; }
a:focus-visible, button:focus-visible { outline: 1px solid #000; outline-offset: 6px; }
a:hover, button:hover { opacity: .55; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 245px; padding: 50px 0 40px 50px; }
.name { display: inline-block; font-size: 28px; font-weight: 500; line-height: 1.2; white-space: nowrap; }
.menu-bar { display: contents; }
.personal-menu, .menu-switch { display: none; }
nav { display: flex; flex-direction: column; align-items: flex-start; gap: 0; margin-top: 37px; }
nav a { font-size: 16px; line-height: 1.4; padding: .2em 0; }
.about-link { line-height: 1.4; }
[aria-current="page"] { color: #858585; }
.about-link { display: block; width: fit-content; margin: 29px 0 0; padding: 0; text-align: left; font-size: 12px; }
.desktop-menu-switch { display: block; position: relative; width: var(--landscape-switch-width, 66px); height: 10px; padding: 0; margin-top: 20px; border: 1px solid #000; background: #000; }
.desktop-menu-switch::after { content: ""; position: absolute; inset: -8px 0; }
.desktop-menu-switch:hover, .desktop-menu-switch:active { opacity: 1; }
.desktop-menu-switch[aria-expanded="true"] { background: #fff; }
.desktop-personal-links { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 23.2px; }
.desktop-personal-links a { font-size: 12px; line-height: 1.4; }
.desktop-personal-links .about-link { margin: 0; }
.socials { display: flex; gap: 13px; margin-top: 17px; align-items: center; }
.socials a { display: flex; align-items: center; justify-content: center; padding: 4px 0; line-height: 0; }
.socials svg { display: block; flex: none; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.socials .letterboxd-logo { width: 27px; height: 17px; stroke-width: 1.5; }
.socials .solid { fill: currentColor; stroke: none; }
main { margin-left: 245px; padding: var(--page-inset) var(--page-inset) var(--page-inset) 30px; min-height: 100svh; display: flex; align-items: center; justify-content: center; }
.gallery { width: 100%; }
.photo-stage { touch-action: pan-y pinch-zoom; height: calc(100svh - 2 * var(--page-inset)); display: flex; align-items: flex-end; justify-content: center; }
.photo-stage img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.gallery-controls { position: fixed; bottom: calc(var(--page-inset) - 2px); display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 0; }
.photo-navigation { display: flex; align-items: center; gap: 4px; }
.gallery-controls button { font-size: 12px; font-style: italic; text-transform: lowercase; line-height: 14px; padding: 0; min-height: 0; }
#previous, #next { text-align: left; }
#grid-toggle { display: block; }
.photo-grid { position: relative; width: 100%; max-width: none; }
.photo-grid button { position: absolute; display: block; padding: 0; margin: 0; }
.photo-grid img { display: block; width: 100%; height: auto; }
main:has(.photo-grid:not([hidden])) { align-items: flex-start; }
[hidden] { display: none !important; }
.video-page { width: 100%; max-width: 1180px; }
.video-page iframe { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; }
.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, .9fr); gap: clamp(32px, 5vw, 80px); align-items: center; width: 100%; max-width: 1000px; }
.portrait { display: block; width: 100%; height: auto; max-height: 72vh; object-fit: contain; }
.about h1 { font-size: 16px; font-weight: 700; margin: 0 0 24px; }
.about p { font-size: 16px; line-height: 1.8; margin: 0 0 16px; max-width: 350px; }
.sr-only, .skip-link { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
.skip-link:focus { width: auto; height: auto; clip-path: none; padding: 12px; background: white; z-index: 2; }
@media (max-width: 900px) { :root { --page-inset: 32px; } .sidebar { width: 212px; padding-left: 32px; } .name { font-size: 22px; } main { margin-left: 212px; padding-left: 24px; } .about { grid-template-columns: 1fr; max-width: 450px; gap: 32px; } .portrait { max-height: 55vh; } }
@media (max-width: 600px) {
  :root { --mobile-section-gap: 20px; }
  #albums .video-link { display: none; }
  body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto auto auto 1fr;
    min-height: 100svh;
    gap: 0 16px;
    padding: max(24px, env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
  }
  .sidebar { display: contents; }
  .name { grid-column: 1; grid-row: 1; font-size: 22px; justify-self: start; }
  .socials { display: none; }
  .socials a { min-height: 44px; }
  nav {
    grid-column: 1 / -1;
    grid-row: 2;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0 18px;
    margin-top: var(--mobile-section-gap);
  }
  nav a { display: flex; align-items: center; min-height: 40px; font-size: 14px; padding: 0; }

  .desktop-personal-links, .desktop-menu-switch { display: none; }
  .menu-bar {
    display: flex;
    grid-column: 1 / -1;
    grid-row: 2;
    position: relative;
    min-width: 0;
    min-height: 40px;
    margin-top: var(--mobile-section-gap);
    padding-right: 32px;
  }
  .menu-bar nav {
    flex: 1;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0;
    gap: 18px;
  }
  .menu-bar nav::-webkit-scrollbar { display: none; }
  .menu-bar nav a { flex: none; white-space: nowrap; }
  .menu-bar .personal-menu { display: none; }
  body[data-personal-menu="true"] #albums { display: none; }
  body[data-personal-menu="true"] .personal-menu { display: flex; }
  .menu-switch {
    display: block;
    position: absolute;
    right: 0;
    top: 13px;
    width: 14px;
    height: 14px;
    padding: 0;
    border: 1px solid #000;
    background: #000;
  }
  .menu-switch:hover, .menu-switch:active { opacity: 1; }
  .menu-switch { -webkit-tap-highlight-color: transparent; }
  .menu-switch::after { content: ""; position: absolute; inset: -12px; }
  body[data-personal-menu="true"] .menu-switch { background: #fff; }
  .about-link { grid-column: 1 / -1; grid-row: 3; margin: 0 0 16px; font-size: 12px; padding: 8px 0; }
  main { grid-column: 1 / -1; grid-row: 4; margin: 0; min-width: 0; min-height: 0; padding: 0; }
  .photo-stage { height: auto; align-items: center; }
  .photo-stage img { max-height: 56svh; }
  .gallery-controls {
    grid-column: 1 / -1;
    grid-row: 5;
    position: static;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    margin-top: 0;
    gap: 0;
  }
  .gallery-controls button { display: flex; align-items: flex-start; min-height: 24px; padding: 4px 0 0; font-size: 10px; }
  #grid-toggle { display: flex; }
  .photo-navigation { align-items: flex-start; gap: 8px; }
  .photo-navigation > span { padding-top: 4px; line-height: 14px; font-size: 10px; }
  /* Center the photo itself in the space between about and the footer. */
  body:has(.gallery) {
    height: max(100svh, 640px);
    grid-template-rows: auto auto auto minmax(260px, 1fr) 0 auto;
  }
  body:has(.gallery) .about-link { margin-bottom: 0; }
  body:has(.video-page) {
    height: max(100svh, 640px);
    grid-template-rows: auto auto auto minmax(260px, 1fr) 0 auto;
  }
  main:has(.video-page) { height: 100%; align-items: center; justify-content: center; }
  main:has(.gallery) { height: 100%; }
  .gallery { height: 100%; }
  .gallery .photo-stage { height: 100%; }
  .gallery .photo-stage img {
    width: 100%;
    height: 100%;
    max-height: calc(100% - 100px);
    object-fit: contain;
    object-position: center;
  }
  .gallery-controls {
    grid-row: 6;
    align-self: end;
    justify-self: start;
    transform: none;
  }
  body:has(.photo-grid:not([hidden])) { height: auto; min-height: 100svh; grid-template-rows: auto auto auto auto 0 1fr; }
  main:has(.photo-grid:not([hidden])), main:has(.about) { height: auto; align-items: flex-start; padding-top: var(--mobile-section-gap); }
  .about { max-width: none; gap: 24px; }
  .portrait { max-height: 55svh; }
  .about p { font-size: 15px; max-width: none; }
}

@media (min-width: 601px) {
  main:has(.gallery) {
    margin-left: var(--name-right, 180px);
    padding-left: var(--page-inset);
    padding-right: var(--page-inset);
  }
}

/* A sideways phone keeps its own compact sidebar instead of the desktop UI. */
@media (orientation: landscape) and (max-height: 600px) and (max-width: 1100px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  :root { --page-inset: 20px; }
  body, body:has(.gallery), body:has(.video-page), body:has(.photo-grid:not([hidden])) {
    display: block;
    height: auto;
    min-height: 100svh;
    padding: 0;
  }
  .sidebar {
    display: block;
    position: fixed;
    inset: calc(20px + env(safe-area-inset-top)) auto calc(20px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left));
    width: 148px;
    padding: 0;
    overflow-y: auto;
  }
  .name { font-size: 22px; }
  .menu-bar {
    display: block;
    position: relative;
    width: max-content;
    min-width: 0;
    min-height: 0;
    margin-top: 22px;
    padding: 0 0 12px;
  }
  .menu-bar nav {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 0;
    margin: 0;
    overflow: visible;
  }
  .menu-bar nav a { font-size: 14px; line-height: 1.4; min-height: 0; padding: 4px 0; white-space: nowrap; }
  #albums .video-link { display: none; }
  .menu-bar .personal-menu { display: none; }
  body[data-personal-menu="true"] #albums { display: none; }
  body[data-personal-menu="true"] .personal-menu { display: flex; }
  .desktop-personal-links, .desktop-menu-switch, .socials { display: none; }
  .gallery-controls {
    display: flex;
    position: fixed;
    left: calc(24px + env(safe-area-inset-left));
    bottom: calc(100svh - var(--landscape-photo-bottom, calc(100svh - 20px)) - 2px);
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    margin: 0;
    transform: translateY(3px);
  }
  .gallery-controls button { display: flex; align-items: flex-start; font-size: 10px; line-height: 14px; font-style: italic; min-height: 24px; padding: 4px 0 0; }
  #grid-toggle { display: flex; }
  .photo-navigation { align-items: flex-start; gap: 8px; }
  .photo-navigation > span { padding-top: 4px; line-height: 14px; font-size: 10px; }
  .menu-switch {
    display: block;
    position: relative;
    inset: auto;
    width: var(--landscape-switch-width, 60px);
    height: 14px;
    padding: 0;
    margin-top: 10px;
    border: 1px solid #000;
    background: #000;
    -webkit-tap-highlight-color: transparent;
  }
  .menu-switch:hover, .menu-switch:active { opacity: 1; }
  .menu-switch::after { content: ""; position: absolute; inset: -8px 0; }
  body[data-personal-menu="true"] .menu-switch { background: #fff; }
  main, main:has(.gallery), main:has(.video-page), main:has(.about), main:has(.photo-grid:not([hidden])) {
    display: flex;
    margin-left: calc(172px + env(safe-area-inset-left));
    padding: calc(20px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) 20px;
    min-height: 100svh;
    height: auto;
    align-items: center;
    justify-content: center;
  }
  .gallery { width: 100%; height: auto; }
  .photo-stage, .gallery .photo-stage { height: calc(100svh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); align-items: center; justify-content: center; }
  .photo-stage img, .gallery .photo-stage img { width: 100%; height: 100%; max-height: 100%; object-fit: contain; object-position: center; }
  main:has(.photo-grid:not([hidden])) { align-items: flex-start; }
  .about { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; max-width: 100%; }
  .portrait { max-height: calc(100svh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .about > * { min-width: 0; max-width: 100%; }
  .about p { font-size: 14px; line-height: 1.6; overflow-wrap: break-word; }
  .video-page { width: min(100%, calc((100svh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 16 / 9)); }
}

@media (orientation: landscape) and (max-height: 350px) and (max-width: 1100px) {
  .menu-bar { margin-top: 10px; padding-bottom: 0; }
  .menu-bar nav a { padding: 0; }
  .menu-switch { margin-top: 8px; }
}

@media (min-width: 601px) and (hover: hover) and (pointer: fine) {
  #photo[data-direction="previous"] { cursor: w-resize; }
  #photo[data-direction="next"] { cursor: e-resize; }
  #photo[data-direction="gallery"] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='7' fill='none' stroke='white' stroke-width='3'/%3E%3Ccircle cx='12' cy='12' r='7' fill='none' stroke='black' stroke-width='1'/%3E%3C/svg%3E") 12 12, pointer; }
}

@media (hover: hover) and (pointer: fine) {
  a[href="https://letterboxd.com/saumit/"] { cursor: url("assets/letterboxd-cursor.svg") 12 8, pointer; }
}
