/* underwater-words.css
 *
 * The words in the underwater scene (js/scenes/underwater/underwater-words.js
 * places them down the painting): the title and the intro just below the
 * surface; the project cards in the open water; experience
 * and education deeper; and the button on the sea floor.
 *
 * Same system as the day beach: handwritten headings in Nanum Pen Script,
 * lettered and painted by hand (hand-lettering.js, hand-paint.js), and
 * everything else in Inter, all in the warm off-white with a soft shadow
 * (--warm-white, --words-shadow and --hand-shadow, in base.css).
 */

#scene-underwater {
  /* The column the words are in: at most --words-column wide, and at
     least --words-side from the screen's edges. */
  --words-column: 640px;
  --words-side: clamp(20px, 5vw, 48px);

  /* Sizes. */
  --title-size: clamp(2.6rem, 2rem + 2.6vw, 4rem);
  --section-heading-size: clamp(2.2rem, 1.8rem + 1.6vw, 3rem);
  --intro-size: clamp(0.95rem, 0.9rem + 0.3vw, 1.12rem);
  --card-name-size: clamp(1.1rem, 1.04rem + 0.3vw, 1.25rem);
  --body-size: clamp(0.92rem, 0.89rem + 0.15vw, 1rem);
  --small-size: 0.82rem;

  /* Spacing: between the three groups at least (where the painting has
     room, they spread further apart), between blocks inside a group,
     between the project cards, between the experience and the education,
     and inside a card. */
  --group-gap-least: 3rem;
  --block-gap: 1.1rem;
  --card-gap: 0.9rem;
  --deeper-gap: 2.5rem;
  --card-padding: clamp(1rem, 0.85rem + 0.7vw, 1.35rem);

  /* The project cards: a very subtle see-through deep blue (no blur, so
     the painting shows through), with a faint warm edge. */
  --card-panel: rgba(8, 30, 78, 0.2);
  --card-edge: rgba(244, 237, 224, 0.1);
  --card-radius: 14px;

  /* Quieter text: the tags, a role, years. */
  --quiet-white: rgba(244, 237, 224, 0.78);

  /* Links: an underline in a softer off-white, full on hover. */
  --link-underline: rgba(244, 237, 224, 0.45);

  /* Each block fades in over --reveal-fade, rising --reveal-rise, as it
     scrolls into view. */
  --reveal-fade: 1.1s;
  --reveal-rise: 10px;

  /* The button on the sea floor: a deeper version of the cards' panel
     (the sand behind it is pale, so the off-white needs more blue behind
     it to read), and a clear ring when it has keyboard focus. */
  --button-panel: rgba(8, 30, 78, 0.5);
  --button-panel-hover: rgba(8, 30, 78, 0.62);
  --button-edge: rgba(244, 237, 224, 0.28);
  --button-main-size: clamp(1.9rem, 1.6rem + 1vw, 2.4rem);
  --focus-ring: #f4ede0;
}

/* ---- The column ----------------------------------------------------------- */

/* Above the creatures and the light (z-index 2). Its top and height
   (from the surface down to just above the corals) are set by
   underwater-words.js; the three groups spread out over that height. */
.underwater-words {
  position: absolute;
  left: 50%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* At least this much space between the groups (underwater-words.js
     measures the words with it, to know how tall they need to be). */
  gap: var(--group-gap-least);
  width: min(var(--words-column), 100% - 2 * var(--words-side));
  transform: translateX(-50%);
  color: var(--warm-white);
  /* The sea creatures swim underneath the words and the cards: plain text
     lets clicks through to a creature passing behind it. Only the links
     take clicks (below). (The handwritten letters still move when the
     pointer passes: letter-springs.js watches the pointer itself.) */
  pointer-events: none;
}

.underwater-words a,
.underwater-words button {
  pointer-events: auto;
}

.underwater-words h2,
.underwater-words h3,
.underwater-words h4,
.underwater-words p,
.underwater-words ul {
  margin: 0;
}

.underwater-words ul {
  padding: 0;
  list-style: none;
}

/* Every word in Inter has the soft shadow; the handwriting has its own
   (as filters, with its paint). */
.underwater-words :is(p, li, h4, a) {
  text-shadow: var(--words-shadow);
}

/* Handwriting: the paint (--hand-paint, set by hand-paint.js once made),
   then the soft shadow. */
.underwater-words .hand-written,
.contact-button__main {
  filter: var(--hand-paint,) var(--hand-shadow);
  text-shadow: none;
}

.underwater-words a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.underwater-words a:hover {
  text-decoration-color: currentColor;
}

.underwater-words a:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---- Title and intro ----------------------------------------------------- */

.underwater-words__opening {
  display: flex;
  flex-direction: column;
  gap: var(--block-gap);
}

.underwater-title {
  font-size: var(--title-size);
  line-height: 0.95;
}

.underwater-intro {
  font-size: var(--intro-size);
  line-height: 1.55;
  text-wrap: pretty;
}

/* ---- Projects ------------------------------------------------------------ */

.underwater-words__projects {
  display: flex;
  flex-direction: column;
  gap: var(--card-gap);
}

.section-heading {
  font-size: var(--section-heading-size);
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: var(--card-padding);
  border: 1px solid var(--card-edge);
  border-radius: var(--card-radius);
  background: var(--card-panel);
}

.project-card__name {
  font-size: var(--card-name-size);
  font-weight: 600;
  line-height: 1.25;
}

.project-card__role {
  margin-top: -0.3rem;
  font-size: var(--small-size);
  color: var(--quiet-white);
}

.project-card__description {
  font-size: var(--body-size);
  line-height: 1.55;
  text-wrap: pretty;
}

/* Small, quiet, separated by middle dots. */
.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  font-size: var(--small-size);
  color: var(--quiet-white);
}

.project-card__tags li + li::before {
  /* The dot is decoration: screen readers read the list itself. */
  content: "·" / "";
  padding: 0 0.45em;
}

.project-card__link {
  align-self: flex-start;
  font-size: var(--body-size);
  font-weight: 500;
}

/* ---- Experience and education -------------------------------------------- */

.underwater-words__deeper {
  display: flex;
  flex-direction: column;
  gap: var(--deeper-gap);
}

.underwater-words__deeper section {
  display: flex;
  flex-direction: column;
  gap: var(--block-gap);
}

.life-list {
  display: flex;
  flex-direction: column;
  gap: var(--block-gap);
}

.life-entry__name {
  font-size: var(--body-size);
  font-weight: 600;
  line-height: 1.35;
}

.life-entry__meta {
  font-size: var(--small-size);
  line-height: 1.45;
  color: var(--quiet-white);
}

.life-entry__line {
  margin-top: 0.3rem;
  font-size: var(--body-size);
  line-height: 1.55;
}

/* ---- Fading in ------------------------------------------------------------ */

/* Until a block scrolls into view (underwater-words.js adds is-revealed),
   it waits, invisible and a little lower. For less motion, it simply
   appears. */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    translate: 0 var(--reveal-rise);
    transition: opacity var(--reveal-fade) ease, translate var(--reveal-fade) ease;
  }

  .reveal.is-revealed {
    opacity: 1;
    translate: 0 0;
  }
}

/* ---- The button on the sea floor ----------------------------------------- */

/* Placed by underwater-words.js (its middle at --button-x, --button-y),
   on the sand between the corals; above the light, like the words. */
.contact-button {
  position: absolute;
  left: var(--button-x, 50%);
  top: var(--button-y, 86%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.75rem 1.6rem 0.85rem;
  border: 1px solid var(--button-edge);
  border-radius: 18px;
  background: var(--button-panel);
  color: var(--warm-white);
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: background-color 0.2s ease;
  touch-action: manipulation;
  /* No blue flash on tap (phones add one). */
  -webkit-tap-highlight-color: transparent;
}

.contact-button:hover {
  background: var(--button-panel-hover);
}

.contact-button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 4px;
}

.contact-button__main {
  font-size: var(--button-main-size);
}

.contact-button__sub {
  font-size: var(--small-size);
  letter-spacing: 0.02em;
  text-shadow: var(--words-shadow);
}
