/* wood.as — shared styles
   Two palettes, two pages. Hero = paper + ink + forest cursor.
   Rings = cream + umber + seasonal accent (set inline by JS).
*/

:root {
  --paper: #F6F2EA;
  --cream: #EFE8D8;
  --ink: #1C1A18;
  --umber: #3B2B1E;
  --cursor: #2F4A3A;
  --ghost: #8A847A;
  --ghost-beige: #9C917D;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* -------------------------------------------------------------------------
 * HERO PAGE
 * ---------------------------------------------------------------------- */

body.hero {
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  padding: 0 6vw;
}

body.hero main {
  width: 100%;
  text-align: center;
}

#phrase {
  font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  font-weight: 400;
  font-size: clamp(2.25rem, 7vw, 7.5rem);
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
  text-wrap: balance;
  user-select: none;
  /* keep the whole phrase centered as a block */
}

#phrase .fixed {
  font-style: normal;
  font-weight: 400;
  /* never break between "wood." and "as" */
  white-space: nowrap;
}

/* the nbsp between fixed and tail — force it to behave as a non-breaking
   space regardless of surrounding white-space rules */
#phrase .sep {
  white-space: pre;
}

#phrase .tail {
  font-style: italic;
  font-weight: 300;
  color: var(--ink);
  /* allow the completion to wrap at word boundaries — without this
     long phrases overflow narrow viewports and get clipped left */
  white-space: normal;
}

#phrase .tail.link-hint {
  cursor: pointer;
  text-decoration-color: var(--ghost);
  text-decoration-thickness: 0.02em;
  text-underline-offset: 0.15em;
}
#phrase .tail.link-hint:hover {
  text-decoration: underline;
  text-decoration-color: var(--cursor);
}

#cursor {
  display: inline-block;
  width: 0.08em;
  height: 0.9em;
  background: var(--cursor);
  vertical-align: -0.05em;
  margin-left: 0.04em;
  transform: translateY(0.04em);
  animation: blink 530ms steps(1) infinite;
  cursor: pointer;
}
#cursor.steady { animation: none; opacity: 1; }
#cursor.paused { animation: none; opacity: 1; }

@keyframes blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

/* Inline typing toy */
.toy {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}
#toy-input {
  font-family: "Source Serif 4", Georgia, serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.25rem, 3.5vw, 3rem);
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--ghost);
  color: var(--ink);
  outline: none;
  padding: 0.25em 0.5em;
  min-width: 16ch;
  text-align: center;
}

/* Hero footer */
body.hero footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ghost);
  pointer-events: none;
}
body.hero footer a,
body.hero footer .foot-left,
body.hero footer .foot-right { pointer-events: auto; }

body.hero #contact-dot {
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
body.hero .contact-label {
  opacity: 0;
  transition: opacity 200ms ease;
  color: var(--ghost);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
}
body.hero #contact-dot:hover .contact-label,
body.hero #contact-dot:focus-visible .contact-label { opacity: 1; }
body.hero .dot {
  font-size: 28px;
  line-height: 0;
  color: var(--ink);
  opacity: 0.8;
  transition: opacity 200ms ease;
}
body.hero #contact-dot:hover .dot,
body.hero #contact-dot:focus-visible .dot { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  #cursor { animation: none; opacity: 1; }
}

/* Mobile tweaks */
@media (max-width: 640px) {
  body.hero { padding: 0 5vw; }
  #phrase {
    font-size: clamp(1.75rem, 8.5vw, 2.75rem);
    line-height: 1.25;
  }
  body.hero footer { padding: 1.25rem; }
}

/* -------------------------------------------------------------------------
 * RINGS PAGE
 * ---------------------------------------------------------------------- */

body.rings {
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  --accent: #A85A32; /* default rust; overridden inline by JS */
}

.ring-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 2rem;
  z-index: 5;
  pointer-events: none;
}

.wordmark {
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--ghost-beige);
  text-transform: uppercase;
}

.ring-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem 6rem;
  gap: 2.5rem;
}

.ring-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(72vmin, 720px);
  height: min(72vmin, 720px);
  cursor: pointer;
}
.ring-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.caption {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}
.caption figcaption {
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  color: var(--ink);
  display: inline-flex;
  gap: 0.5em;
  align-items: baseline;
}
.caption .latin { font-style: italic; }
.caption .common { font-weight: 400; }
.caption .sep { color: var(--ghost-beige); }
.caption hr {
  border: none;
  height: 1px;
  width: 80px;
  background: var(--accent);
  margin: 0;
  opacity: 0;
  transition: opacity 400ms ease;
}
.caption.saved hr { opacity: 1; }

.caption.saved figcaption {
  position: relative;
  padding: 0 1rem;
}
.caption.saved figcaption::before,
.caption.saved figcaption::after {
  content: "";
  position: absolute;
  top: -0.4rem;
  bottom: -0.4rem;
  width: 0.5rem;
  border: 1px solid var(--umber);
  opacity: 0;
  animation: bracket 900ms ease forwards;
}
.caption.saved figcaption::before { left: 0; border-right: none; }
.caption.saved figcaption::after { right: 0; border-left: none; }

@keyframes bracket {
  0% { opacity: 0; }
  20% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

.ring-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
}

.ring-footer a.back,
.ring-footer .permalink {
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ghost-beige);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 200ms ease;
}
.ring-footer a.back:hover,
.ring-footer .permalink:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .caption.saved figcaption::before,
  .caption.saved figcaption::after { animation: none; opacity: 0; }
}

@media (max-width: 640px) {
  .ring-header { padding: 1.25rem; }
  .ring-footer { padding: 1.25rem; }
  .ring-main { padding: 3rem 1rem 4rem; }
  .ring-stage { width: min(86vmin, 560px); height: min(86vmin, 560px); }
}
