/* Comic Strip - A Free Design by Bryant Smith (bryantsmith.com)
   A life story told in eight inked panels. No images, no JavaScript:
   every shape, tail and halftone dot on the page is pure CSS.
   Look for the section headings below to find what you want to change. */


/* ---- COLOURS: edit these and the whole strip is re-inked ---- */

:root {
    --cream:  #f4efe1;   /* the newsprint page */
    --paper:  #fffdf6;   /* panel and bubble fill */
    --ink:    #16130f;   /* the thick black outline */
    --red:    #cf3322;   /* accent one */
    --yellow: #f5c33b;   /* accent two */
    --dull:   #ddd6c6;   /* the grey of a hard year */
}


/* ---- BODY: the newsprint desk the page sits on ---- */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--cream);
    background-image: radial-gradient(circle, rgba(22, 19, 15, 0.05) 1px, transparent 1.2px);
    background-size: 9px 9px;                        /* faint paper grain */
    color: var(--ink);
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 16px;
    line-height: 1.7;
    padding: 40px 16px 24px 16px;
    text-align: center;
}

#page {
    margin: 0 auto;
    max-width: 960px;
    text-align: left;
}

a:focus-visible {
    outline: 3px solid var(--red);
    outline-offset: 2px;
}


/* ---- MASTHEAD: the cover of the comic ---- */

#masthead {
    background: var(--ink);
    background-image: radial-gradient(circle, rgba(244, 239, 225, 0.10) 1px, transparent 1.3px);
    background-size: 7px 7px;
    border: 4px solid var(--ink);
    border-radius: 6px;
    box-shadow: 8px 8px 0 var(--red);
    color: var(--cream);
    margin-bottom: 30px;
    padding: 30px 34px 26px 34px;
    position: relative;
}

#masthead .issue {
    color: var(--yellow);
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 3px;
    text-transform: uppercase;
}

#masthead h1 {
    color: var(--paper);
    font-family: Impact, Haettenschweiler, "Arial Narrow Bold", "Arial Black", sans-serif;
    font-size: 82px;
    font-weight: normal;
    letter-spacing: 1px;
    line-height: 0.95;
    margin: 10px 0 6px 0;
    text-shadow: 5px 5px 0 var(--red);
    text-transform: uppercase;
}

#masthead .tagline {
    color: #cdc7b6;
    font-size: 17px;
    font-style: italic;
}


/* ---- MENU: the row of links under the title ---- */

#menu {
    margin-top: 22px;
}

#menu a,
#menu a:visited {
    border-bottom: 3px solid transparent;
    color: var(--cream);
    display: inline-block;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 2px;
    margin: 0 20px 6px 0;
    padding-bottom: 3px;
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.15s ease, border-color 0.15s ease;
}

#menu a:hover {
    border-bottom-color: var(--yellow);
    color: var(--yellow);
}


/* ---- STRIP: the comic page itself ----
   A six-column grid. The grid-template-areas below decide which panel
   sits where; each panel then claims its area by name. */

#strip {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(6, 1fr);
    grid-template-areas:
        "arrival arrival arrival arrival arrival arrival"
        "drawing drawing drawing school  school  school"
        "work    work    work    work    hard    hard"
        "good    good    home    home    home    home"
        "point   point   point   point   point   point";
}

#p-arrival { grid-area: arrival; }
#p-drawing { grid-area: drawing; }
#p-school  { grid-area: school; }
#p-work    { grid-area: work; }
#p-hard    { grid-area: hard; }
#p-good    { grid-area: good; }
#p-home    { grid-area: home; }
#p-point   { grid-area: point; }


/* ---- PANEL: one inked frame of the story ---- */

.panel {
    background: var(--paper);
    border: 4px solid var(--ink);
    border-radius: 6px;
    box-shadow: 7px 7px 0 var(--ink);
    display: flex;
    min-height: 260px;
    overflow: hidden;                                 /* keeps halftone dots inside the frame */
    padding: 16px 16px 22px 16px;
    position: relative;
}

/* the big ghosted panel number in the corner */
.panel__no {
    color: rgba(22, 19, 15, 0.10);
    font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
    font-size: 58px;
    line-height: 1;
    position: absolute;
    right: 12px;
    top: 4px;
    z-index: 0;
}

/* halftone dot shading, laid over the panel fill */
.dots {
    background-image: radial-gradient(circle, rgba(22, 19, 15, 0.30) 1px, transparent 1.3px);
    background-size: 6px 6px;
    inset: 0;
    pointer-events: none;
    position: absolute;
    z-index: 0;
}

/* the content sits above the dots */
.panel__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* wide splash panels put the text beside the drawing */
.panel__body--row {
    align-items: center;
    flex-direction: row;
    gap: 26px;
}

.panel__text {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.panel__text .bubble {
    margin-top: auto;
}

.panel__art {
    align-items: center;
    display: flex;
    flex: 0 0 230px;
    justify-content: center;
    min-height: 150px;
    padding: 8px;
}

.panel__body:not(.panel__body--row) .panel__art {
    flex: 1;
}


/* ---- PANEL COLOURS: the handful of tinted frames ---- */

.panel--red {
    background: var(--red);
    color: var(--paper);
}

.panel--red .dots {
    background-image: radial-gradient(circle, rgba(255, 253, 246, 0.35) 1px, transparent 1.3px);
}

.panel--red .panel__no {
    color: rgba(255, 253, 246, 0.22);
}

.panel--yellow {
    background: var(--yellow);
}

.panel--dull {
    background: var(--dull);
}

.panel--ink {
    background: var(--ink);
    box-shadow: 7px 7px 0 var(--red);
    color: var(--cream);
}

.panel--ink .dots {
    background-image: radial-gradient(circle, rgba(244, 239, 225, 0.16) 1px, transparent 1.3px);
}

.panel--ink .panel__no {
    color: rgba(244, 239, 225, 0.20);
}

#p-arrival,
#p-point {
    min-height: 300px;
}


/* ---- CAPTION: the yellow label at the top of a panel ---- */

.caption {
    align-self: flex-start;
    background: var(--yellow);
    border: 3px solid var(--ink);
    border-radius: 4px;
    box-shadow: 3px 3px 0 var(--ink);
    color: var(--ink);
    display: inline-block;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1.5px;
    line-height: 1.3;
    margin-bottom: 12px;
    padding: 6px 10px;
    text-transform: uppercase;
}

/* on a yellow panel the caption switches to white so it still reads */
.panel--yellow .caption {
    background: var(--paper);
}


/* ---- NARRATION: the plain spoken-word bits ---- */

.narration {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 12px;
    opacity: 0.92;
}

/* the red and black frames keep their narration at full strength */
.panel--red .narration,
.panel--ink .narration {
    opacity: 1;
}


/* ---- BUBBLES: speech and thought, with CSS tails ----
   The tail is a zero-size box whose coloured borders form a triangle.
   A slightly larger black triangle sits behind a white one to make ink. */

.bubble {
    align-self: flex-start;
    background: var(--paper);
    border: 3px solid var(--ink);
    border-radius: 16px;
    box-shadow: 3px 3px 0 rgba(22, 19, 15, 0.85);
    color: var(--ink);
    display: inline-block;
    font-family: "Comic Sans MS", "Segoe Print", "Comic Neue", cursive;
    font-size: 15px;
    line-height: 1.35;
    margin-bottom: 22px;
    max-width: 92%;
    padding: 10px 14px 11px 14px;
    position: relative;
}

/* a speaking bubble: pointed tail below, on the left by default */
.bubble--say::before {
    border-bottom: 0;
    border-left: 11px solid transparent;
    border-right: 11px solid transparent;
    border-top: 20px solid var(--ink);
    content: "";
    height: 0;
    left: 24px;
    position: absolute;
    top: 100%;
    width: 0;
}

.bubble--say::after {
    border-bottom: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-top: 16px solid var(--paper);
    content: "";
    height: 0;
    left: 26px;
    position: absolute;
    top: 100%;
    width: 0;
}

/* a thinking bubble: soft corners and a trail of little dots */
.bubble--think {
    border-radius: 28px 22px 30px 24px;
}

.bubble--think::before,
.bubble--think::after {
    background: var(--paper);
    border: 3px solid var(--ink);
    border-radius: 50%;
    content: "";
    position: absolute;
    top: 100%;
}

.bubble--think::before {
    height: 14px;
    left: 22px;
    margin-top: 3px;
    width: 14px;
}

.bubble--think::after {
    height: 9px;
    left: 13px;
    margin-top: 22px;
    width: 9px;
}

/* flip a tail to the right-hand side of its panel */
.bubble--right {
    align-self: flex-end;
}

.bubble--right.bubble--say::before {
    left: auto;
    right: 24px;
}

.bubble--right.bubble--say::after {
    left: auto;
    right: 26px;
}

.bubble--right.bubble--think::before {
    left: auto;
    right: 22px;
}

.bubble--right.bubble--think::after {
    left: auto;
    right: 13px;
}


/* ---- ART: little CSS spot drawings, no images ----
   .burst is the pale ray ring behind each emblem. */

.burst {
    align-items: center;
    display: flex;
    height: 180px;
    justify-content: center;
    position: relative;
    width: 180px;
}

.burst::before {
    background: repeating-conic-gradient(from 0deg, rgba(22, 19, 15, 0.12) 0deg 8deg, rgba(22, 19, 15, 0) 8deg 16deg);
    border-radius: 50%;
    content: "";
    height: 176px;
    position: absolute;
    width: 176px;
    z-index: -1;
}

.panel--red .burst::before,
.panel--ink .burst::before {
    background: repeating-conic-gradient(from 0deg, rgba(255, 253, 246, 0.20) 0deg 8deg, rgba(255, 253, 246, 0) 8deg 16deg);
}

/* a sun: a striped disc inside two ink rings */
.sun {
    background: repeating-conic-gradient(from 0deg, var(--yellow) 0deg 9deg, #fbe08a 9deg 18deg);
    border: 4px solid var(--ink);
    border-radius: 50%;
    box-shadow: 0 0 0 6px var(--paper), 0 0 0 10px var(--ink);
    height: 104px;
    width: 104px;
}

/* a scribbled star, cut out with clip-path and outlined by drop-shadow */
.star {
    background: var(--red);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    filter: drop-shadow(2px 0 0 var(--ink)) drop-shadow(-2px 0 0 var(--ink)) drop-shadow(0 2px 0 var(--ink)) drop-shadow(0 -2px 0 var(--ink));
    height: 128px;
    width: 128px;
}

/* an open book: two skewed pages with ruled lines */
.book {
    height: 96px;
    position: relative;
    width: 150px;
}

.book::before,
.book::after {
    background-color: var(--paper);
    background-image: repeating-linear-gradient(rgba(22, 19, 15, 0.25) 0 1px, transparent 1px 13px);
    border: 4px solid var(--ink);
    content: "";
    height: 96px;
    position: absolute;
    top: 0;
    width: 75px;
}

.book::before {
    border-radius: 6px 2px 2px 6px;
    left: 0;
    transform: skewY(6deg);
}

.book::after {
    border-radius: 2px 6px 6px 2px;
    right: 0;
    transform: skewY(-6deg);
}

/* a clock: a disc with two rotated hands */
.clock {
    background: radial-gradient(circle, var(--ink) 5px, var(--paper) 6px);
    border: 4px solid var(--ink);
    border-radius: 50%;
    box-shadow: 0 0 0 6px var(--yellow), 0 0 0 10px var(--ink);
    height: 108px;
    position: relative;
    width: 108px;
}

/* the two hands stand up from the centre and are rotated about their base */
.clock-hand {
    background: var(--ink);
    border-radius: 3px;
    bottom: 50%;
    left: 50%;
    position: absolute;
    transform-origin: bottom center;
}

.clock-hand--hour {
    height: 30px;
    margin-left: -3px;
    transform: rotate(-120deg);
    width: 6px;
}

.clock-hand--minute {
    background: var(--red);
    height: 42px;
    margin-left: -2px;
    transform: rotate(20deg);
    width: 4px;
}

/* a rain cloud: a body joined by a lobe, outlined together by a drop-shadow
   (the shadow follows the joined silhouette, so no seam line shows through) */
.cloud {
    background: var(--paper);
    border-radius: 28px;
    filter: drop-shadow(2px 0 0 var(--ink)) drop-shadow(-2px 0 0 var(--ink)) drop-shadow(0 2px 0 var(--ink)) drop-shadow(0 -2px 0 var(--ink));
    height: 52px;
    margin-bottom: 38px;
    position: relative;
    width: 138px;
}

.cloud::before {
    background: var(--paper);
    border-radius: 50%;
    content: "";
    height: 66px;
    left: 16px;
    position: absolute;
    top: -40px;
    width: 66px;
}

.cloud::after {
    background: var(--ink);
    border-radius: 4px;
    box-shadow: 24px 6px 0 var(--ink), 48px -2px 0 var(--ink), 72px 6px 0 var(--ink);
    content: "";
    height: 24px;
    left: 20px;
    position: absolute;
    top: 100%;
    width: 6px;
}

/* two lives overlapping: a simple venn of colour */
.venn {
    height: 116px;
    position: relative;
    width: 176px;
}

.venn::before,
.venn::after {
    border: 4px solid var(--ink);
    border-radius: 50%;
    content: "";
    height: 112px;
    position: absolute;
    top: 0;
    width: 112px;
}

.venn::before {
    background: rgba(255, 253, 246, 0.82);
    left: 0;
}

.venn::after {
    background: rgba(22, 19, 15, 0.45);
    right: 0;
}

/* a home window: a square divided by a cross */
.window {
    background: var(--paper);
    border: 4px solid var(--ink);
    border-radius: 4px;
    box-shadow: 5px 5px 0 rgba(22, 19, 15, 0.20);
    height: 116px;
    position: relative;
    width: 116px;
}

.window::before {
    background: var(--ink);
    bottom: -4px;
    content: "";
    left: 50%;
    margin-left: -2px;
    position: absolute;
    top: -4px;
    width: 4px;
}

.window::after {
    background: var(--ink);
    content: "";
    height: 4px;
    left: -4px;
    margin-top: -2px;
    position: absolute;
    right: -4px;
    top: 50%;
}

/* a heart: two lobes outlined together by a drop-shadow */
.heart {
    filter: drop-shadow(2px 0 0 var(--ink)) drop-shadow(-2px 0 0 var(--ink)) drop-shadow(0 2px 0 var(--ink)) drop-shadow(0 -2px 0 var(--ink));
    height: 112px;
    position: relative;
    width: 124px;
}

.heart::before,
.heart::after {
    background: var(--red);
    border-radius: 62px 62px 0 0;
    content: "";
    height: 96px;
    position: absolute;
    top: 0;
    width: 62px;
}

.heart::before {
    left: 62px;
    transform: rotate(-45deg);
    transform-origin: 0 100%;
}

.heart::after {
    left: 0;
    transform: rotate(45deg);
    transform-origin: 100% 100%;
}

/* the rubber stamp that closes the story */
.end-stamp {
    align-self: flex-start;
    border: 3px solid var(--yellow);
    border-radius: 4px;
    color: var(--yellow);
    display: inline-block;
    font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
    font-size: 22px;
    letter-spacing: 3px;
    padding: 2px 12px 4px 12px;
    text-transform: uppercase;
    transform: rotate(-4deg);
}


/* ---- LETTERS PAGE: the how-to-edit column ---- */

#letters {
    background: var(--paper);
    border: 4px solid var(--ink);
    border-radius: 6px;
    box-shadow: 8px 8px 0 var(--yellow);
    margin-top: 30px;
    padding: 30px 34px 26px 34px;
}

#letters h2 {
    color: var(--ink);
    font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
    font-size: 30px;
    font-weight: normal;
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

#letters h2::after {
    background: var(--red);
    content: "";
    display: block;
    height: 5px;
    margin-top: 8px;
    width: 90px;
}

.letters-lead {
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.letters-cols {
    column-count: 2;
    column-gap: 34px;
}

.letters-cols p {
    margin-bottom: 16px;
}

.letters-cols code {
    background: var(--yellow);
    border-radius: 3px;
    color: var(--ink);
    font-family: "Courier New", Courier, monospace;
    font-size: 13px;
    padding: 1px 5px;
}

.letters-signoff {
    border-top: 3px solid var(--ink);
    font-style: italic;
    margin-top: 8px;
    padding-top: 14px;
}


/* ---- FOOTER: the required credit link ---- */

#footer {
    border-top: 3px solid var(--ink);
    color: #6b6455;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    letter-spacing: 1px;
    margin-top: 40px;
    padding-top: 20px;
    text-align: center;
    text-transform: uppercase;
}

#footer a,
#footer a:visited {
    color: #5f594b;
    text-decoration: none;
}

#footer a:hover {
    color: var(--red);
}


/* ---- NARROW SCREENS: stack the panels into one column ---- */

@media (max-width: 780px) {
    #strip {
        grid-template-columns: 1fr;
        grid-template-areas:
            "arrival"
            "drawing"
            "school"
            "work"
            "hard"
            "good"
            "home"
            "point";
    }

    /* every panel becomes its natural height and reads top to bottom */
    .panel {
        min-height: 0;
    }

    .panel__body--row {
        align-items: flex-start;
        flex-direction: column;
    }

    .panel__art,
    .panel__body:not(.panel__body--row) .panel__art {
        flex: none;
        width: 100%;
    }
}


/* ---- SMALL SCREENS (phones): trim the padding and type ---- */

@media (max-width: 640px) {
    body {
        padding: 20px 10px 16px 10px;
    }

    #masthead {
        padding: 22px 20px 20px 20px;
    }

    #masthead h1 {
        font-size: 46px;
    }

    #letters {
        padding: 22px 20px 20px 20px;
    }

    #letters h2 {
        font-size: 24px;
    }

    .letters-cols {
        column-count: 1;
    }

    .letters-lead {
        font-size: 16px;
    }
}


/* ---- PRINT: drop the tint and shadows for a clean sheet ---- */

@media print {
    body {
        background: #ffffff;
        padding: 0;
    }

    #menu,
    .dots,
    .burst::before {
        display: none;
    }

    #masthead,
    .panel,
    #letters,
    #footer {
        box-shadow: none;
    }
}
