/* Helen Currie portfolio.
   Warm off-white paper, pastel cloud shapes, serif headings, white cards with straight corners.
   html[data-photos] = "edited" | "original" picks which photo set is visible when both are built. */

:root {
  color-scheme: light;
  --paper: #fbf8f3;
  --card: #ffffff;
  --ink: #2b2522;
  --muted: #7d746d;
  --rule: #eee7dd;
  --c1: #f6dfd8;          /* blush */
  --c2: #f9edd2;          /* butter */
  --c3: #e9e2f3;          /* lilac */
  --font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Inter, Arial, sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --gutter: 16px;
  --frame: 12px;          /* Polaroid side margin */
  --frame-bottom: 18px;   /* Polaroid bottom margin before the caption */
}

/* ---- base --------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--font); overflow-x: hidden; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; margin: 0; letter-spacing: -0.01em; }

/* ---- clouds ------------------------------------------------------------- */
.cloud { position: absolute; width: 260px; height: auto; pointer-events: none; }
.cloud:nth-child(1) { fill: var(--c1); }
.cloud:nth-child(2) { fill: var(--c2); }
.cloud:nth-child(3) { fill: var(--c3); }
.cloud:nth-child(4) { fill: var(--c2); }

.backdrop { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; opacity: .55; }
.backdrop .cloud:nth-child(1) { width: 44vw; right: -14vw; top: 60rem; }
.backdrop .cloud:nth-child(2) { width: 38vw; left: -12vw; top: 110rem; }
.backdrop .cloud:nth-child(3) { width: 42vw; right: -10vw; top: 190rem; }

/* ---- masthead ----------------------------------------------------------- */
.masthead { position: relative; overflow: hidden; z-index: 1; padding: clamp(2rem, 4vw, 3rem) var(--gutter) clamp(1.2rem, 2.5vw, 1.8rem); text-align: center; }
.sky { position: absolute; inset: 0; pointer-events: none; }
.sky .cloud:nth-child(1) { width: clamp(220px, 34vw, 420px); left: -6%; top: 6%; }
.sky .cloud:nth-child(2) { width: clamp(160px, 26vw, 320px); right: -4%; top: 14%; }
.sky .cloud:nth-child(3) { width: clamp(200px, 30vw, 380px); left: -8%; bottom: -45%; }
.sky .cloud:nth-child(4) { width: clamp(120px, 16vw, 220px); right: 18%; bottom: 4%; }
.masthead-inner { position: relative; max-width: 44rem; margin: 0 auto; }
.masthead h1 { font-size: clamp(2.2rem, 4.5vw, 2.9rem); line-height: 1.05; }
.tagline { margin: .4rem 0 0; font-size: 1rem; color: var(--muted); }
.school { margin: .9rem 0 0; font-size: .92rem; color: var(--muted); }
.award { margin: .9rem auto 0; max-width: 36rem; font-family: var(--display); font-size: 1.05rem; }
.award.secondary { margin-top: .25rem; color: var(--muted); font-size: .95rem; }

/* ---- sections ----------------------------------------------------------- */
main { position: relative; z-index: 1; max-width: 76rem; margin: 0 auto; padding: 0 var(--gutter) 4rem; }
.section { padding-top: 1.6rem; }
.section + .section { margin-top: 2.5rem; padding-top: 2.5rem; border-top: 1px solid var(--rule); }
.section h2 { font-size: 1.6rem; }
.section-intro { margin: .5rem 0 0; max-width: 40rem; color: var(--muted); font-size: .95rem; }

/* Every card in a section shares the image window aspect (--aspect, set per section),
   so cards in a row are the same height; the image sits on the card's white, letterboxed invisibly. */
.grid { display: grid; gap: 2.5rem 2rem; margin-top: 1.1rem; grid-template-columns: minmax(0, 1fr); align-items: stretch; }
@media (min-width: 760px)  { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* on wide screens: two pieces sit two-up at two-thirds width; four pieces go four across, so no orphan row */
@media (min-width: 1200px) {
  .grid:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 66%; }
  .grid:has(> :nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2.5rem 1.5rem; }
  /* featured section (Paintings): two wide cards per row so the main work is not the smallest on the page */
  .section.is-featured .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem 2rem; max-width: none; }
}

/* ---- card --------------------------------------------------------------- */
.piece { position: relative; min-width: 0; background: var(--card); padding: var(--frame) var(--frame) var(--frame-bottom); display: flex; flex-direction: column; }
.window { position: relative; aspect-ratio: var(--aspect); overflow: hidden; max-height: 84vh; max-height: 84svh; }
.window picture, .window img { position: absolute; inset: 0; width: 100%; height: 100%; }
.window img { object-fit: contain; }
.window picture[hidden] { display: none; }

/* caption sits straight under the image on every card; the thumbnail row goes to the foot of the card,
   so titles line up across a row whether or not a piece has several views */
.piece .caption { order: 2; }
.piece .angles { order: 3; margin-top: auto; padding-top: 1rem; }
.angles { list-style: none; margin: .7rem 0 0; padding: 0 0 .2rem; display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; }
.angles::-webkit-scrollbar { display: none; }
.angles li { flex: 0 0 auto; }
.angles button { width: 64px; text-align: center; font-size: .7rem; color: var(--muted); line-height: 1.15; }
.angles picture { display: block; }
.angles img { width: 64px; height: 64px; object-fit: contain; background: #fff; opacity: .7; border: 2px solid transparent; transition: opacity .15s; }
.angles button:hover img, .angles button.is-current img { opacity: 1; }
.angles button.is-current img { border-color: #d9b5a9; }
.angles button:focus-visible img { outline: 2px solid var(--ink); outline-offset: 2px; }
.angles span { display: block; margin-top: .25rem; }

.caption { margin-top: .9rem; }
.caption h3 { font-size: 1.3rem; }
.meta { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }
.note { margin: .45rem 0 0; font-family: var(--display); font-size: 1.02rem; line-height: 1.45; color: #3a332f; }

.colophon { position: relative; z-index: 1; text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem var(--gutter) 3rem; }

/* ---- card: straight corners, hairline border, light shadow ---- */
.piece {
  border: 1px solid #e8e1d6;
  box-shadow: 0 1px 2px rgba(60, 40, 20, .05), 0 8px 24px rgba(60, 40, 20, .06);
}

/* ---- the Congressional winner: gold double frame and a rosette by the title ---- */
.piece.is-winner { border-color: #d2ad55; outline: 1px solid #e6d294; outline-offset: 3px; box-shadow: 0 1px 2px rgba(120, 90, 20, .08), 0 8px 24px rgba(120, 90, 20, .10); }
.laurel { display: inline-block; vertical-align: -.22em; width: 1.05em; height: 1.15em; margin-right: .3em; }
.rosette { display: block; width: 100%; height: 100%; }
.rosette .rib { fill: #d26a5a; }
.rosette .disc { fill: #e3bb4f; }
.rosette .ring { fill: none; stroke: #fff; stroke-width: .9; opacity: .85; }
.rosette .star { fill: #fff; }
.lb-caption .laurel { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); }

/* ---- photo set toggle (only built while both sets exist) ---------------- */
.lightbox .photo-pick { bottom: max(.8rem, env(safe-area-inset-bottom)); }
.photo-pick { position: fixed; right: .8rem; bottom: max(.8rem, env(safe-area-inset-bottom)); z-index: 40; display: flex; gap: .25rem; align-items: center; padding: .3rem .4rem .3rem .8rem; border-radius: 999px; background: rgba(255, 255, 255, .94); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 6px 18px rgba(0, 0, 0, .08); font-size: .75rem; color: var(--muted); }
.photo-pick button { padding: .35rem .7rem; border-radius: 999px; font-weight: 600; font-size: .78rem; color: var(--ink); }
html[data-photos="edited"] .photo-pick button[data-photos="edited"],
html[data-photos="original"] .photo-pick button[data-photos="original"] { background: var(--ink); color: #fff; }

/* both sets are in the page and loaded; only the chosen one is visible, so the switch is instant */
html[data-photos="edited"] picture[data-v="original"],
html[data-photos="original"] picture[data-v="edited"] { visibility: hidden; }
.angles .thumb { position: relative; display: block; width: 64px; height: 64px; }
.angles .thumb picture { position: absolute; inset: 0; }

@media (prefers-reduced-motion: no-preference) {
  .sky .cloud { animation: drift 40s ease-in-out infinite alternate; }
  .sky .cloud:nth-child(2) { animation-duration: 55s; }
  .sky .cloud:nth-child(3) { animation-duration: 48s; animation-direction: alternate-reverse; }
  @keyframes drift { from { transform: translateX(0); } to { transform: translateX(28px); } }
}

/* ---- phone -------------------------------------------------------------- */
@media (max-width: 600px) {
  .masthead { padding-top: 2.6rem; padding-bottom: 1.6rem; }
  .masthead h1 { font-size: 2.3rem; }
  .school { margin-top: 1rem; font-size: .9rem; }
  .award { margin-top: 1rem; font-size: 1rem; }
  .section { padding-top: 1.6rem; }
  .grid { margin-top: 1rem; gap: 2rem; }
  .sky .cloud:nth-child(1) { width: 240px; left: -34%; top: -4%; }
  .sky .cloud:nth-child(2) { width: 200px; right: -30%; top: 26%; }
  .sky .cloud:nth-child(3) { display: none; }
  .sky .cloud:nth-child(4) { width: 150px; right: -14%; bottom: -8%; }
}

/* ---- at one scale: three paintings stacked largest first, sharing the bottom-right corner ---- */
.stack { position: relative; width: 100%; max-width: 40rem; aspect-ratio: 1 / 1; margin-top: 1.1rem; background: var(--card); border: 1px solid #e8e1d6; box-shadow: 0 1px 2px rgba(60, 40, 20, .05), 0 8px 24px rgba(60, 40, 20, .06); }
.stack .layer { position: absolute; right: 0; bottom: 0; outline: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25), 0 10px 24px rgba(0, 0, 0, .18); }
.stack .layer.is-base { inset: 0; outline: 0; box-shadow: none; }
.stack picture, .stack img { display: block; width: 100%; height: 100%; object-fit: cover; }
.stack .tagline { position: absolute; left: .5rem; top: .45rem; max-width: calc(100% - 1rem); font-size: .8rem; line-height: 1.2; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .75), 0 0 12px rgba(0, 0, 0, .35); }
.stack .is-base .tagline { left: auto; right: .6rem; top: .5rem; white-space: nowrap; }
.stack .is-small .tagline { left: auto; top: auto; right: calc(100% + .5rem); bottom: .1rem; max-width: none; white-space: nowrap; }
@media (max-width: 600px) { .stack .tagline { font-size: .72rem; } }

/* ---- lightbox ----------------------------------------------------------- */
.window { cursor: zoom-in; }
.window:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
body.lb-open { overflow: hidden; }
.lightbox { border: 0; padding: 0; margin: auto; background: transparent; color: #fff;
  width: 96vw; height: 94vh; max-width: none; max-height: none; overflow: visible; touch-action: pan-y; }
.lightbox[open] { display: flex; flex-direction: column; align-items: center; }
.lightbox::backdrop { background: rgba(32, 26, 22, .72); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.lightbox:focus { outline: none; }
.lb-stage { flex: 1; min-height: 0; width: 100%; position: relative; will-change: transform; }
.lb-stage.is-snapping { transition: transform .22s ease, opacity .22s ease; }
@media (prefers-reduced-motion: reduce) { .lb-stage.is-snapping { transition: none; } }
.lb-stage picture { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.lb-stage picture[hidden] { display: none; }
.lb-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; cursor: default; -webkit-user-drag: none; user-select: none; -webkit-user-select: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3); }
.lb-angles { flex: 0 0 auto; margin-top: .9rem; max-width: 100%; }
.lb-angles .angles { margin: 0; justify-content: center; touch-action: pan-x; }
.lb-angles .angles button { color: rgba(255, 255, 255, .75); }
.lb-angles .angles img { opacity: .55; }
.lb-angles .angles button:hover img, .lb-angles .angles button.is-current img { opacity: 1; }
.lb-angles .angles button.is-current img { border-color: #fff; }
.lb-caption { flex: 0 0 auto; margin-top: .7rem; padding-bottom: max(.2rem, env(safe-area-inset-bottom)); text-align: center; max-width: 44rem; }
.lb-caption h3 { font-size: 1.4rem; color: #fff; }
.lb-caption .meta { color: rgba(255, 255, 255, .7); }
.lb-caption .note { color: rgba(255, 255, 255, .88); font-size: 1rem; }
.lb-nav { position: fixed; z-index: 3; top: max(.8rem, env(safe-area-inset-top)); left: 1rem; display: flex; align-items: center; }
.lb-count { height: 44px; display: flex; align-items: center; padding: 0 .9rem; border-radius: 999px;
  background: rgba(0, 0, 0, .32); color: rgba(255, 255, 255, .9); font-size: .85rem; letter-spacing: .02em; }
.lb-close { position: fixed; z-index: 3; top: max(.8rem, env(safe-area-inset-top)); right: 1rem; width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0, 0, 0, .32); color: #fff; font-size: 1.7rem; line-height: 1; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.lb-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lb-prev, .lb-next { position: fixed; z-index: 3; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0, 0, 0, .32); color: #fff; font-size: 2rem; line-height: 1; display: flex; align-items: center; justify-content: center; padding-bottom: 4px; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.lb-prev { left: .8rem; } .lb-next { right: .8rem; }
/* hover darkening only where a pointer can hover: a tapped button on Android keeps :hover until the next tap */
@media (hover: hover) { .lb-close:hover, .lb-prev:hover, .lb-next:hover { background: rgba(0, 0, 0, .5); } }
.lb-prev:disabled, .lb-next:disabled { opacity: .25; cursor: default; }
.lb-prev:focus-visible, .lb-next:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
/* Controls toggle: a tap on the picture hides the counter, close, arrows, thumbs, and caption, so the
   picture has the whole viewport; a second tap brings them back. */
.lb-nav, .lb-close { transition: opacity .18s ease; }
.lightbox.ui-hidden .lb-nav, .lightbox.ui-hidden .lb-close { opacity: 0; pointer-events: none; }
.lightbox.ui-hidden .lb-angles, .lightbox.ui-hidden .lb-caption { display: none; }
.lightbox.ui-hidden { padding: 0 !important; }
.lightbox.ui-hidden .lb-stage img { box-shadow: none; }

@media (max-width: 600px) {
  /* phone: the picture fills the width; the arrows sit over its edges like a camera roll */
  .lightbox { width: 100vw; height: 100dvh; padding: calc(44px + max(.8rem, env(safe-area-inset-top)) + .5rem) 0 .6rem; }
  .lb-stage img { box-shadow: none; }
  .lb-prev, .lb-next { width: 40px; height: 40px; font-size: 1.8rem; background: rgba(0, 0, 0, .38); }
  .lb-prev { left: .5rem; } .lb-next { right: .5rem; }
  .lb-nav { left: .8rem; }
  .lb-close { right: .8rem; }
  .lb-caption { padding-left: 12px; padding-right: 12px; }
  .lb-caption h3 { font-size: 1.15rem; }
  .lb-caption .note { display: none; }   /* room for the picture; the note is on the card */
}
@media (max-height: 520px) {
  /* short viewports (landscape phones): the picture gets the height */
  .lightbox { width: 100vw; height: 100dvh; padding: .5rem 56px .4rem; }
  .lb-stage img { box-shadow: none; }
  .lb-angles { margin-top: .4rem; }
  .lb-angles .angles button, .lb-angles .angles .thumb, .lb-angles .angles img { width: 44px; }
  .lb-angles .angles .thumb, .lb-angles .angles img { height: 44px; }
  .lb-angles .angles span { display: none; }
  .lb-caption { margin-top: .3rem; }
  .lb-caption h3 { font-size: 1rem; }
  .lb-caption .meta { font-size: .8rem; }
  .lb-caption .note { display: none; }
  .lb-nav, .lb-close { top: .5rem; }
  .lb-count, .lb-close { height: 36px; }
  .lb-close { width: 36px; font-size: 1.4rem; }
}
/* touch screens: the arrows join the counter in one pill at the top, so it is plain that there is a previous
   and a next piece; swiping works as well. Side arrows would sit over the picture on a phone. */
@media (hover: none) and (pointer: coarse) {
  .lb-nav { height: 44px; border-radius: 999px; background: rgba(0, 0, 0, .32); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
  .lb-prev, .lb-next { position: static; transform: none; width: 44px; height: 44px; background: none; box-shadow: none; font-size: 1.7rem; padding-bottom: 3px; }
  .lb-count { height: 44px; padding: 0 .15rem; background: none; }
}
@media (hover: none) and (pointer: coarse) and (max-height: 520px) {
  .lb-nav, .lb-prev, .lb-next, .lb-count { height: 36px; }
  .lb-prev, .lb-next { width: 36px; font-size: 1.4rem; }
}
