:root {
  --font-heading: "Solway", Georgia, serif;
  --font-body: "Quicksand", "Helvetica Neue", "Helvetica", "Arial", sans-serif;

  --color-bg: #c6e4e6;
  --color-text: #2b2a2e;
  --color-accent: #0fa1c6;
  --color-accent-secondary: #0B82A0;
  --color-accent-dark: #06667E;   /* ~4.9:1 on --color-bg, safe for text */
  --color-accent-darker: #054E61; /* ~6.9:1 on --color-bg */

  --color-link: var(--color-accent-dark);
  --color-link-hover: var(--color-accent-darker);
  --color-button: var(--color-accent-dark);
  --color-button-text: var(--color-bg);  /* ~4.9:1 on --color-button */
  --color-button-text-hover: #fff;       /* ~6.5:1 on --color-button */
  --color-button-shadow: var(--color-accent-darker); /* shadow stays darker than the button */
  --color-focus: #3478f6; /* for focus-visible outlines */

  --max-width: 960px;
}

/* @media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #141414;
    --color-text: #ededea;
    --color-accent: #8aa8ff;
  }
} */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* stop iOS enlarging text in landscape */
html { -webkit-text-size-adjust: 100%; }
/* images never overflow the column */
img, svg { display: block; max-width: 100%; }
/* form controls use the page font */
input, button, textarea, select { font: inherit; }

body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
}

a {
  display: flex;
  align-items: center;
  column-gap: 0.15rem;
  color: var(--color-link);
  font-weight: 500;
  transition:
    color 0.2s ease-in-out,
    box-shadow 0.2s ease-in-out,
    transform 0.2s ease-in-out;
}

a:hover {
  color: var(--color-link-hover);
}

/* Visible ring when tabbing with a keyboard; mouse clicks don't trigger it */
a:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

.button {
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  color: var(--color-button-text);
  background-color: var(--color-button);
  text-decoration: none;
  box-shadow: 5px 5px 0px 0px var(--color-button-shadow);
}

.button:hover {
  color: var(--color-button-text-hover);
  box-shadow: 2px 2px 0px 0px var(--color-button-shadow);
  transform: translateY(3px);
}

.button:focus-visible {
  outline-offset: 1px;
}

main {
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: var(--max-width);
  min-height: 100vh;
  min-height: 100dvh; /* excludes mobile browser toolbars where supported */
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-areas:
    "heading profile-image"
    "intro profile-image"
    "actions profile-image"
    "links profile-image";
  grid-template-columns: 4fr 3fr;
  column-gap: 1.5rem;
  padding: 3rem 16px;
}

.heading {
  grid-area: heading;
  font-family: var(--font-heading);
  font-size: 6.81rem;
  font-weight: 400;
  letter-spacing: -0.5rem;
  line-height: 0.76;
  text-align: center;
  margin: 0 0 1.5rem;
}

/* Wrapper so the speech bubble can sit on top of the image */
.profile-image-wrap {
  grid-area: profile-image;
  align-self: center;
  position: relative;
}

.profile-image {
  width: 100%;
  height: auto; /* keep proportions; the HTML width/height only reserve space while loading */
}

/* "Hello World!" bubble that pops up when the image is hovered */
.speech-bubble {
  position: absolute;
  top: -4%;
  left: -6%;
  padding: 0.5rem 1rem;
  border: 3px solid var(--color-text); /* matches the art's outline */
  border-radius: 1.25rem;
  background: #fff;
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: 1.25rem;
  white-space: nowrap;
  pointer-events: none; /* never blocks hovering the image */
  opacity: 0;
  transform: scale(0.6) translateY(0.5rem);
  transform-origin: bottom right; /* grows out from the tail */
  transition:
    opacity 0.2s ease-out,
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* slight overshoot for a "pop" */
}

/* Tail pointing down toward her face: an outlined triangle with a white one on top */
.speech-bubble::before,
.speech-bubble::after {
  content: "";
  position: absolute;
  right: 1.25rem;
  border-style: solid;
  border-color: transparent;
}

/* Equal left/right borders make a symmetrical triangle pointing straight down */
.speech-bubble::before {
  top: 100%;
  border-width: 14px 9px 0;
  border-top-color: var(--color-text);
}

/* Smaller white triangle, centered over the dark one, so only an outline shows */
.speech-bubble::after {
  top: calc(100% - 2px);
  right: calc(1.25rem + 2px);
  border-width: 11px 7px 0;
  border-top-color: #fff;
}

.profile-image-wrap:hover .speech-bubble {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* Fade only, no pop, for visitors who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  .speech-bubble,
  .profile-image-wrap:hover .speech-bubble {
    transform: none;
  }
}

.intro {
  grid-area: intro;
  margin: 0 0 1.5rem;
  font-size: 1.125rem;
}

.actions,
.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.actions {
  grid-area: actions;
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.links {
  grid-area: links;
  gap: 0.2rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.link {
  text-decoration-thickness: 1px;
}

.link:hover {
  text-decoration-style: wavy;
}

@media (max-width: 959px) {
  .heading {
    font-size: 5.625rem;
  }
}

@media (max-width: 840px) {
  /* Adjust the speech bubble so it doesn't cover her crown */
  .speech-bubble {
    top: -6%;
    left: -10%;
  }
}

/* Phone layout: one column, image on top, heading scales with the screen */
@media (max-width: 800px) {
  .hero {
    grid-template-areas:
      "profile-image"
      "heading"
      "intro"
      "actions"
      "links";
    grid-template-columns: minmax(0, 1fr);
    padding-block: 2rem;
  }

  .profile-image-wrap {
    justify-self: center;
    width: min(200px, 55%);
    margin-bottom: 1.5rem;
  }

  /* Smaller bubble, nudged left so it doesn't cover her crown */
  .speech-bubble {
    top: 0;
    left: -30%;
    font-size: 1rem;
    border-width: 2px; /* thinner outline to suit the smaller bubble */
  }

  /* Bigger white triangle so the tail's outline matches the 2px border */
  .speech-bubble::after {
    right: calc(1.25rem + 1px);
    border-width: 12px 8px 0;
  }

  .heading {
    letter-spacing: -0.07em; /* same tightness as desktop, scaled to the font size */
    line-height: 0.85;       /* a little looser so wrapped lines don't collide */
  }
}

@media (max-width: 459px) {
  .links {
    column-gap: 0.75rem;
  }
}